Class OIDCTokens


  • public final class OIDCTokens
    extends Tokens
    ID token, access token and optional refresh token.
    • Constructor Detail

      • OIDCTokens

        public OIDCTokens​(com.nimbusds.jwt.JWT idToken,
                          AccessToken accessToken,
                          RefreshToken refreshToken)
        Creates a new OpenID Connect tokens instance.
        Parameters:
        idToken - The ID token. Must not be null.
        accessToken - The access token. Must not be null.
        refreshToken - The refresh token. If none null.
      • OIDCTokens

        public OIDCTokens​(String idTokenString,
                          AccessToken accessToken,
                          RefreshToken refreshToken)
        Creates a new OpenID Connect tokens instance.
        Parameters:
        idTokenString - The ID token string. Must not be null.
        accessToken - The access token. Must not be null.
        refreshToken - The refresh token. If none null.
      • OIDCTokens

        public OIDCTokens​(AccessToken accessToken,
                          RefreshToken refreshToken)
        Creates a new OpenID Connect tokens instance without an ID token. Intended for token responses from a refresh token grant where the ID token is optional.
        Parameters:
        accessToken - The access token. Must not be null.
        refreshToken - The refresh token. If none null.
    • Method Detail

      • getIDToken

        public com.nimbusds.jwt.JWT getIDToken()
        Gets the ID token.
        Returns:
        The ID token, null if none or if parsing to a JWT failed.
      • getIDTokenString

        public String getIDTokenString()
        Gets the ID token string.
        Returns:
        The ID token string, null if none or if serialisation to a string failed.
      • toJSONObject

        public net.minidev.json.JSONObject toJSONObject()
        Description copied from class: Tokens
        Returns the JSON object representation of this token pair.

        Example JSON object:

         {
           "access_token"  : "dZdt8BlltORMTz5U",
           "refresh_token" : "E87zjAoeNXaSoF1U"
         }
         
        Overrides:
        toJSONObject in class Tokens
        Returns:
        The JSON object representation.
      • parse

        public static OIDCTokens parse​(net.minidev.json.JSONObject jsonObject)
                                throws ParseException
        Parses an OpenID Connect tokens instance from the specified JSON object.
        Parameters:
        jsonObject - The JSON object to parse. Must not be null.
        Returns:
        The OpenID Connect tokens.
        Throws:
        ParseException - If the JSON object couldn't be parsed to an OpenID Connect tokens instance.