Class OAuth2InfoContext

java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.openig.filter.oauth2.client.OAuth2InfoContext
All Implemented Interfaces:
Context

public class OAuth2InfoContext extends AbstractContext
Context holding the OAuth2 information gathered after a successful user authentication and authorization.

Note that getAccessTokenResponse() may return outdated information if the access token has been refreshed since the initial token acquisition. Use other methods to get up-to-date information.

  • Method Details

    • getUserInfo

      public Map<String,Object> getUserInfo()
      Returns the user info retrieved from the OIDC UserInfo endpoint. May be empty.
      Returns:
      the user info retrieved from the OIDC UserInfo endpoint. May be empty
    • getAccessToken

      public String getAccessToken()
      Returns the OAuth2 access token.
      Returns:
      the OAuth2 access token
    • getRefreshToken

      public String getRefreshToken()
      Returns the OAuth2 refresh token.
      Returns:
      the OAuth2 refresh token
    • getIdToken

      public String getIdToken()
      Returns the OIDC ID token.

      Note that it is not recommended to re-use this token after the initial authentication as it may have expired.

      Returns:
      the OIDC ID token
    • getClientRegistrationId

      public String getClientRegistrationId()
      Returns the OAuth2 client registration ID.
      Returns:
      the OAuth2 client registration ID
    • getClientEndpoint

      public String getClientEndpoint()
      Returns the OAuth2 client endpoint.
      Returns:
      the OAuth2 client endpoint
    • getAccessTokenExpiresIn

      public Long getAccessTokenExpiresIn()
      Returns the OAuth2 access token time to live in seconds, if any..
      Returns:
      the OAuth2 access token time to live in seconds, if any.
    • getScopes

      public List<String> getScopes()
      Returns the OAuth2 scopes granted.
      Returns:
      the OAuth2 scopes granted
    • getIdTokenClaims

      public JwtClaimsSet getIdTokenClaims()
      Returns the ID Token claims set, if any.

      Note that it is not recommended to re-use these claims after the initial authentication as they may have expired.

      Returns:
      the ID Token claims set, if any.
    • getAccessTokenResponse

      public Map<String,Object> getAccessTokenResponse()
      Returns the access token response content.

      Note that this may contain outdated information if the access token has been refreshed since the initial token acquisition. Use other methods to get up-to-date information.

      Returns:
      the access token response content.