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 using Auth.requestToken(io.ably.lib.rest.Auth.TokenParams, io.ably.lib.rest.Auth.AuthOptions).
  • Field Details

    • keyName

      public 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 String nonce
      A cryptographically secure random string of at least 16 characters, used to ensure the TokenRequest cannot be reused.

      Spec: TE2

    • mac

      public String mac
      The Message Authentication Code for this request.

      Spec: TE2

  • Constructor Details

    • TokenRequest

      public TokenRequest()
    • TokenRequest

      public TokenRequest(Auth.TokenParams params)
  • Method Details

    • fromJSON

      @Deprecated public static Auth.TokenRequest fromJSON(com.google.gson.JsonObject json)
      Deprecated.
      use fromJsonElement(JsonObject json) instead
      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.
    • 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(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 String asJson()
      Convert a TokenParams into a JSON string.
    • equals

      public boolean equals(Object obj)
      Check equality of a TokenRequest
      Overrides:
      equals in class Auth.TokenParams
      Parameters:
      obj -