Package io.ably.lib.rest
Class Auth.TokenDetails
java.lang.Object
io.ably.lib.rest.Auth.TokenDetails
- Enclosing class:
- Auth
public static class Auth.TokenDetails
extends java.lang.Object
Contains an Ably Token and its associated metadata.
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringcapabilityThe capabilities associated with this Ably Token.java.lang.StringclientIdThe client ID, if any, bound to this Ably Token.longexpiresThe timestamp at which this token expires as milliseconds since the Unix epoch.longissuedThe timestamp at which this token was issued as milliseconds since the Unix epoch.java.lang.StringtokenThe Ably Token itself. -
Constructor Summary
Constructors Constructor Description TokenDetails()TokenDetails(java.lang.String token) -
Method Summary
Modifier and Type Method Description java.lang.StringasJson()Convert a TokenDetails into a JSON string.com.google.gson.JsonObjectasJsonElement()Convert a TokenDetails into a JSON object.booleanequals(java.lang.Object obj)Check equality of a TokenDetailsstatic Auth.TokenDetailsfromJson(java.lang.String json)A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object.static Auth.TokenDetailsfromJSON(com.google.gson.JsonObject json)Deprecated.static Auth.TokenDetailsfromJsonElement(com.google.gson.JsonObject json)A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object.inthashCode()
-
Field Details
-
token
public java.lang.String tokenThe Ably Token itself.A typical Ably Token string appears with the form xVLyHw.A-pwh7wicf3afTfgiw4k2Ku33kcnSA7z6y8FjuYpe3QaNRTEo4.
Spec: TD2
-
expires
public long expiresThe timestamp at which this token expires as milliseconds since the Unix epoch.Spec: TD3
-
issued
public long issuedThe timestamp at which this token was issued as milliseconds since the Unix epoch.Spec: TD4
-
capability
public java.lang.String capabilityThe capabilities associated with this Ably Token. The capabilities value is a JSON-encoded representation of the resource paths and associated operations. Read more about capabilities in the capabilities docs.Spec: TD5
-
clientId
public java.lang.String clientIdThe client ID, if any, bound to this Ably Token. If a client ID is included, then the Ably Token authenticates its bearer as that client ID, and the Ably Token may only be used to perform operations on behalf of that client ID. The client is then considered to be an identified client.Spec: TD6
-
-
Constructor Details
-
TokenDetails
public TokenDetails() -
TokenDetails
public TokenDetails(java.lang.String token)
-
-
Method Details
-
fromJSON
Deprecated.A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object. This method is provided to minimize bugs as a result of differing types by platform for fields such as timestamp or ttl. For example, in Ruby ttl in the TokenDetails object is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON using to_json it is automatically converted to the Ably standard which is milliseconds. By using the fromJson() method when constructing a TokenDetails object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TD7
- Parameters:
json- A deserialized TokenDetails-like object or a JSON stringified TokenDetails object.- Returns:
- An Ably authentication token.
-
fromJson
A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object. This method is provided to minimize bugs as a result of differing types by platform for fields such as timestamp or ttl. For example, in Ruby ttl in the TokenDetails object is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON using to_json it is automatically converted to the Ably standard which is milliseconds. By using the fromJson() method when constructing a TokenDetails object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TD7
- Parameters:
json- A deserialized TokenDetails-like object or a JSON stringified TokenDetails object.- Returns:
- An Ably authentication token.
-
fromJsonElement
A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object. This method is provided to minimize bugs as a result of differing types by platform for fields such as timestamp or ttl. For example, in Ruby ttl in the TokenDetails object is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON using to_json it is automatically converted to the Ably standard which is milliseconds. By using the fromJson() method when constructing a TokenDetails object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TD7
- Parameters:
json- A deserialized TokenDetails-like object or a JSON stringified TokenDetails object.- Returns:
- An Ably authentication token.
-
asJsonElement
public com.google.gson.JsonObject asJsonElement()Convert a TokenDetails into a JSON object. -
asJson
public java.lang.String asJson()Convert a TokenDetails into a JSON string. -
equals
public boolean equals(java.lang.Object obj)Check equality of a TokenDetails- Overrides:
equalsin classjava.lang.Object- Parameters:
obj-
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-