Class Tokens

    • Constructor Detail

      • Tokens

        public Tokens​(AccessToken accessToken,
                      RefreshToken refreshToken)
        Creates a new tokens instance.
        Parameters:
        accessToken - The access token. Must not be null.
        refreshToken - The refresh token. If none null.
    • Method Detail

      • getDPoPAccessToken

        public DPoPAccessToken getDPoPAccessToken()
        Returns the access token as type DPoP.
        Returns:
        The DPoP access token, null if the type is different.
      • getRefreshToken

        public RefreshToken getRefreshToken()
        Returns the optional refresh token.
        Returns:
        The refresh token, null if none.
      • getParameterNames

        public Set<StringgetParameterNames()
        Returns the token parameter names for the included tokens.
        Returns:
        The token parameter names.
      • getMetadata

        public Map<String,​ObjectgetMetadata()
        Returns the optional modifiable token metadata. Intended for server environments.
        Returns:
        The token metadata.
      • toJSONObject

        public net.minidev.json.JSONObject toJSONObject()
        Returns the JSON object representation of this token pair.

        Example JSON object:

         {
           "access_token"  : "dZdt8BlltORMTz5U",
           "refresh_token" : "E87zjAoeNXaSoF1U"
         }
         
        Returns:
        The JSON object representation.
      • toOIDCTokens

        public OIDCTokens toOIDCTokens()
        Casts to OpenID Connect tokens.
        Returns:
        The OpenID Connect tokens (including an ID token).
      • parse

        public static Tokens parse​(net.minidev.json.JSONObject jsonObject)
                            throws ParseException
        Parses an access and optional refresh token from the specified JSON object.
        Parameters:
        jsonObject - The JSON object to parse. Must not be null.
        Returns:
        The tokens.
        Throws:
        ParseException - If the JSON object couldn't be parsed to a tokens instance.