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 Object
Contains an Ably Token and its associated metadata.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The 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

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Convert a TokenDetails into a JSON string.
    com.google.gson.JsonObject
    Convert a TokenDetails into a JSON object.
    boolean
    Check equality of a TokenDetails
    A static factory method to create a TokenDetails object from a deserialized TokenDetails-like object or a JSON stringified TokenDetails object.
    fromJSON(com.google.gson.JsonObject json)
    Deprecated.
    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
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • token

      public String token
      The Ably Token itself.

      A typical Ably Token string appears with the form xVLyHw.A-pwh7wicf3afTfgiw4k2Ku33kcnSA7z6y8FjuYpe3QaNRTEo4.

      Spec: TD2

    • expires

      public long expires
      The timestamp at which this token expires as milliseconds since the Unix epoch.

      Spec: TD3

    • issued

      public long issued
      The timestamp at which this token was issued as milliseconds since the Unix epoch.

      Spec: TD4

    • capability

      public String 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

      public String 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

      public TokenDetails(String token)
  • Method Details

    • fromJSON

      @Deprecated public static Auth.TokenDetails fromJSON(com.google.gson.JsonObject json)
      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

      public static Auth.TokenDetails fromJson(String json)
      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

      public 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. 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 String asJson()
      Convert a TokenDetails into a JSON string.
    • equals

      public boolean equals(Object obj)
      Check equality of a TokenDetails
      Overrides:
      equals in class Object
      Parameters:
      obj -
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object