Package io.ably.lib.rest
Class Auth.TokenRequest
java.lang.Object
io.ably.lib.rest.Auth.TokenParams
io.ably.lib.rest.Auth.TokenRequest
- Enclosing class:
- Auth
Contains the properties of a request for a token to Ably.
Tokens are generated using
Auth.requestToken(io.ably.lib.rest.Auth.TokenParams, io.ably.lib.rest.Auth.AuthOptions)
.-
Field Summary
Modifier and TypeFieldDescriptionThe name of the key against which this request is made.The Message Authentication Code for this request.A cryptographically secure random string of at least 16 characters, used to ensure the TokenRequest cannot be reused.Fields inherited from class io.ably.lib.rest.Auth.TokenParams
capability, clientId, timestamp, ttl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasJson()
Convert a TokenParams into a JSON string.com.google.gson.JsonObject
Convert a TokenParams into a JSON object.boolean
Check equality of a TokenRequeststatic Auth.TokenRequest
A static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest object.static Auth.TokenRequest
fromJSON
(com.google.gson.JsonObject json) Deprecated.use fromJsonElement(JsonObject json) insteadstatic Auth.TokenRequest
fromJsonElement
(com.google.gson.JsonObject json) A static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest object.Methods inherited from class io.ably.lib.rest.Auth.TokenParams
asMap
-
Field Details
-
keyName
The name of the key against which this request is made. The key name is public, whereas the key secret is private.Spec: TE2
-
nonce
A cryptographically secure random string of at least 16 characters, used to ensure the TokenRequest cannot be reused.Spec: TE2
-
mac
The Message Authentication Code for this request.Spec: TE2
-
-
Constructor Details
-
TokenRequest
public TokenRequest() -
TokenRequest
-
-
Method Details
-
fromJSON
Deprecated.use fromJsonElement(JsonObject json) insteadA static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest 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 TokenRequest 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 TokenRequest object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TE6
- Parameters:
-
json
- A deserialized TokenRequest-like object or a JSON stringified TokenRequest object to create a TokenRequest. - Returns:
- An Ably token request object.
-
fromJsonElement
A static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest 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 TokenRequest 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 TokenRequest object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TE6
- Parameters:
-
json
- A deserialized TokenRequest-like object or a JSON stringified TokenRequest object to create a TokenRequest. - Returns:
- An Ably token request object.
-
fromJson
A static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest 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 TokenRequest 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 TokenRequest object, Ably ensures that all fields are consistently serialized and deserialized across platforms.Spec: TE6
- Parameters:
-
json
- A deserialized TokenRequest-like object or a JSON stringified TokenRequest object to create a TokenRequest. - Returns:
- An Ably token request object.
-
asJsonElement
public com.google.gson.JsonObject asJsonElement()Convert a TokenParams into a JSON object. -
asJson
Convert a TokenParams into a JSON string. -
equals
Check equality of a TokenRequest- Overrides:
-
equals
in classAuth.TokenParams
- Parameters:
-
obj
-
-