Package io.ably.lib.rest
Class Auth.TokenDetails
java.lang.Object
io.ably.lib.rest.Auth.TokenDetails
- Enclosing class:
- Auth
Contains an Ably Token and its associated metadata.
-
Field Summary
Modifier and TypeFieldDescriptionThe capabilities associated with this Ably Token.The client ID, if any, bound to this Ably Token.long
The timestamp at which this token expires as milliseconds since the Unix epoch.long
The timestamp at which this token was issued as milliseconds since the Unix epoch.The Ably Token itself. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasJson()
Convert a TokenDetails into a JSON string.com.google.gson.JsonObject
Convert a TokenDetails into a JSON object.boolean
Check equality of a TokenDetailsstatic Auth.TokenDetails
A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object.static Auth.TokenDetails
fromJSON
(com.google.gson.JsonObject json) Deprecated.static Auth.TokenDetails
fromJsonElement
(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.int
hashCode()
-
Field Details
-
token
The 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
The 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
The 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
-
-
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
Convert a TokenDetails into a JSON string. -
equals
Check equality of a TokenDetails -
hashCode
public int hashCode()
-