Class OpenIdCredentials

java.lang.Object
org.eclipse.jetty.security.openid.OpenIdCredentials
All Implemented Interfaces:
Serializable

public class OpenIdCredentials extends Object implements Serializable

The credentials of an user to be authenticated with OpenID Connect. This will contain the OpenID ID Token and the OAuth 2.0 Access Token.

This is constructed with an authorization code from the authentication request. This authorization code is then exchanged using redeemAuthCode(OpenIdConfiguration) for a response containing the ID Token and Access Token. The response is then validated against the OpenIdConfiguration.

See Also:
  • Constructor Details

    • OpenIdCredentials

      public OpenIdCredentials(Map<String,Object> claims)
    • OpenIdCredentials

      public OpenIdCredentials(String authCode, String redirectUri)
  • Method Details

    • getUserId

      public String getUserId()
    • getClaims

      public Map<String,Object> getClaims()
    • getResponse

      public Map<String,Object> getResponse()
    • getErrorFields

      public Fields getErrorFields()

      This returns a non-null value only when redeemAuthCode(OpenIdConfiguration) has been called and an error occurred.

      The returned Fields will contain an entry for OpenIdAuthenticator.ERROR_PARAMETER, and optional fields from the response if present, including error, error_description and error_uri.

      Returns:
      the error fields or null if no error has occurred.
    • redeemAuthCode

      public void redeemAuthCode(OpenIdConfiguration configuration)

      Redeems the Authorization Code with the Token Endpoint to receive an ID Token.

      getErrorFields() should be called directly following this to check if an error occurred.

      Parameters:
      configuration - the openIdConfiguration to use.
    • isExpired

      public boolean isExpired()
    • checkExpiry

      public static boolean checkExpiry(Map<String,Object> claims)