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
public static class Auth.TokenRequest extends Auth.TokenParams
Contains the properties of a request for a token to Ably. Tokens are generated usingAuth.requestToken(io.ably.lib.rest.Auth.TokenParams, io.ably.lib.rest.Auth.AuthOptions).
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringkeyNameThe name of the key against which this request is made.java.lang.StringmacThe Message Authentication Code for this request.java.lang.StringnonceA 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
Constructors Constructor Description TokenRequest()TokenRequest(Auth.TokenParams params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringasJson()Convert a TokenParams into a JSON string.com.google.gson.JsonObjectasJsonElement()Convert a TokenParams into a JSON object.booleanequals(java.lang.Object obj)Check equality of a TokenRequeststatic Auth.TokenRequestfromJson(java.lang.String json)A static factory method to create a TokenRequest object from a deserialized TokenRequest-like object or a JSON stringified TokenRequest object.static Auth.TokenRequestfromJSON(com.google.gson.JsonObject json)Deprecated.use fromJsonElement(JsonObject json) insteadstatic Auth.TokenRequestfromJsonElement(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 Detail
-
keyName
public java.lang.String 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
public java.lang.String nonce
A cryptographically secure random string of at least 16 characters, used to ensure the TokenRequest cannot be reused.Spec: TE2
-
mac
public java.lang.String mac
The Message Authentication Code for this request.Spec: TE2
-
-
Constructor Detail
-
TokenRequest
public TokenRequest()
-
TokenRequest
public TokenRequest(Auth.TokenParams params)
-
-
Method Detail
-
fromJSON
@Deprecated public static Auth.TokenRequest fromJSON(com.google.gson.JsonObject json)
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
public static 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. 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
public static Auth.TokenRequest fromJson(java.lang.String json)
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
public java.lang.String asJson()
Convert a TokenParams into a JSON string.
-
equals
public boolean equals(java.lang.Object obj)
Check equality of a TokenRequest- Overrides:
equalsin classAuth.TokenParams- Parameters:
obj-
-
-