Class AccessTokenInfo

java.lang.Object
org.forgerock.http.oauth2.AccessTokenInfo

public class AccessTokenInfo extends Object
Represents an OAuth2 Access Token.
  • Field Details

    • NEVER_EXPIRES

      public static final long NEVER_EXPIRES
      Marker for never ending tokens.
      See Also:
  • Constructor Details

    • AccessTokenInfo

      public AccessTokenInfo(JsonValue rawInfo, String token, Set<String> scopes, long expiresAt)
      Build an AccessTokenInfo with the provided information. The issuer and authorizationDetails fields are auto-extracted from rawInfo when present.
      Parameters:
      rawInfo - raw response message
      token - token identifier
      scopes - scopes of the token
      expiresAt - Token expiration time expressed as a timestamp, in milliseconds since epoch
    • AccessTokenInfo

      public AccessTokenInfo(JsonValue rawInfo, String token, Set<String> scopes, long expiresAt, String issuer, List<AuthorizationDetails> authorizationDetails)
      Build an AccessTokenInfo with the provided information, including explicit issuer and authorizationDetails.
      Parameters:
      rawInfo - raw response message
      token - token identifier
      scopes - scopes of the token
      expiresAt - Token expiration time expressed as a timestamp, in milliseconds since epoch
      issuer - token issuer (the value of the iss claim), may be null
      authorizationDetails - list of Rich Authorization Request claims, never null
  • Method Details

    • getInfo

      public Map<String,Object> getInfo()
      Returns the raw JSON as a map.
      Returns:
      the raw JSON as a map
    • asJsonValue

      public JsonValue asJsonValue()
      Returns the raw JSON as a JsonValue.
      Returns:
      the raw JSON as a JsonValue
    • getToken

      public String getToken()
      Returns the access token identifier issued from the authorization server.
      Returns:
      the access token identifier issued from the authorization server
    • getScopes

      public Set<String> getScopes()
      Returns the scopes associated to this token. Will return an empty Set if no scopes are associated with this token.
      Returns:
      the scopes associated to this token.
    • getExpiresAt

      public long getExpiresAt()
      Returns the time (expressed as a timestamp in milliseconds since epoch) when this token will be expired. If the NEVER_EXPIRES constant is returned, this token is always considered as available.
      Returns:
      the time (expressed as a timestamp, in milliseconds since epoch) when this token will be expired.
    • getIssuer

      public String getIssuer()
      Returns the token issuer (the value of the iss claim).
      Returns:
      the issuer string, or null when absent from the token
    • getAuthorizationDetails

      public List<AuthorizationDetails> getAuthorizationDetails()
      Returns the list of Rich Authorization Request claims associated with this token, as defined by RFC 9396.
      Returns:
      the list of AuthorizationDetails, never null, empty when none are present