Class StatefulAccessToken

    • Constructor Detail

      • StatefulAccessToken

        public StatefulAccessToken​(org.forgerock.json.JsonValue token)
                            throws InvalidGrantException
        Constructs a new AccessToken backed with the data in the specified JsonValue.
        Parameters:
        token - The JsonValue of the token.
        Throws:
        InvalidGrantException - If the given token is not an Access Token.
      • StatefulAccessToken

        public StatefulAccessToken​(org.forgerock.json.JsonValue token,
                                   String tokenName,
                                   String tokenId)
                            throws InvalidGrantException
        Constructs a new AccessToken backed with the data in the specified JsonValue.
        Parameters:
        token - The JsonValue of the token.
        tokenName - The token name.
        tokenId - The token identifier.
        Throws:
        InvalidGrantException - If the given token is not an Access Token.
      • StatefulAccessToken

        public StatefulAccessToken​(String id,
                                   String authorizationCode,
                                   String resourceOwnerId,
                                   String clientId,
                                   String redirectUri,
                                   Set<String> scope,
                                   long expiryTime,
                                   RefreshToken refreshToken,
                                   String tokenName,
                                   String grantType,
                                   String nonce,
                                   String realm,
                                   String claims,
                                   String auditTrackingId,
                                   org.forgerock.json.JsonValue confirmationKey)
        Constructs a new AccessToken.
        Parameters:
        id - The token id.
        authorizationCode - The authorization code.
        resourceOwnerId - The resource owner's id.
        clientId - The client's id.
        redirectUri - The redirect uri.
        scope - The scope.
        expiryTime - The expiry time.
        refreshToken - The refresh token.
        tokenName - The token name.
        grantType - The grant type.
        nonce - The nonce.
        realm - The realm.
        claims - The requested claims.
        auditTrackingId - The tracking ID, used for tracking tokens throughout the audit logs.
        confirmationKey - JSON confirmation key
      • StatefulAccessToken

        public StatefulAccessToken​(String id,
                                   String authorizationCode,
                                   String resourceOwnerId,
                                   String clientId,
                                   String redirectUri,
                                   Set<String> scope,
                                   long expiryTime,
                                   RefreshToken refreshToken,
                                   String tokenName,
                                   String grantType,
                                   String nonce,
                                   String realm,
                                   String claims,
                                   String auditTrackingId,
                                   long authTime,
                                   org.forgerock.json.JsonValue confirmationKey)
        Constructs a new AccessToken.
        Parameters:
        id - The token id.
        authorizationCode - The authorization code.
        resourceOwnerId - The resource owner's id.
        clientId - The client's id.
        redirectUri - The redirect uri.
        scope - The scope.
        expiryTime - The expiry time.
        refreshToken - The refresh token.
        tokenName - The token name.
        grantType - The grant type.
        nonce - The nonce.
        realm - The realm.
        claims - The requested claims.
        auditTrackingId - The tracking ID, used for tracking tokens throughout the audit logs.
        authTime - The end user's original auth time.
        confirmationKey - JSON confirmation key
    • Method Detail

      • setClaims

        public void setClaims​(String claims)
      • setId

        protected void setId​(String id)
        Sets the token id.
        Overrides:
        setId in class StatefulToken
        Parameters:
        id - The token id.
      • setResourceOwnerId

        protected void setResourceOwnerId​(String resourceOwnerId)
        Sets the resource owner's id.
        Overrides:
        setResourceOwnerId in class StatefulToken
        Parameters:
        resourceOwnerId - The resource owner's id.
      • setClientId

        protected void setClientId​(String clientId)
        Sets the client's id.
        Overrides:
        setClientId in class StatefulToken
        Parameters:
        clientId - The client's id.
      • setRedirectUri

        protected void setRedirectUri​(String redirectUri)
        Sets the redirect uri.
        Overrides:
        setRedirectUri in class StatefulToken
        Parameters:
        redirectUri - The redirect uri.
      • setScope

        protected void setScope​(Set<String> scope)
        Sets the scope.
        Overrides:
        setScope in class StatefulToken
        Parameters:
        scope - The scope.
      • setExpiryTime

        protected void setExpiryTime​(long expiryTime)
        Sets the expiry time.
        Overrides:
        setExpiryTime in class StatefulToken
        Parameters:
        expiryTime - The expiry time.
      • setTokenType

        protected void setTokenType​(String tokenType)
        Sets the token type.
        Overrides:
        setTokenType in class StatefulToken
        Parameters:
        tokenType - The token type.
      • setTokenName

        protected void setTokenName​(String tokenName)
        Sets the token name.
        Overrides:
        setTokenName in class StatefulToken
        Parameters:
        tokenName - The token name.
      • setGrantType

        protected void setGrantType​(String grantType)
        Sets the grant type.
        Overrides:
        setGrantType in class StatefulToken
        Parameters:
        grantType - The grant type.
      • getResourceString

        protected String getResourceString​(String s)
        Gets the display String for the given String.
        Overrides:
        getResourceString in class StatefulToken
        Parameters:
        s - The String.
        Returns:
        The display String.
      • setAuthorizationCode

        protected void setAuthorizationCode​(String authorizationCode)
        Sets the authorization code.
        Parameters:
        authorizationCode - The authorization code.
      • setRefreshTokenId

        protected void setRefreshTokenId​(String refreshTokenId)
        Sets the refresh token id.
        Parameters:
        refreshTokenId - The refresh token id.
      • setNonce

        protected void setNonce​(String nonce)
        Sets the nonce.
        Parameters:
        nonce - The nonce.
      • getSessionId

        public String getSessionId()
        Gets the session id used to create the authorisation code
        Specified by:
        getSessionId in interface AccessToken
        Returns:
        The session id.
      • getGrantType

        public String getGrantType()
        Gets the grant type.
        Specified by:
        getGrantType in interface AccessToken
        Returns:
        The grant type.
      • getConfirmationKey

        public org.forgerock.json.JsonValue getConfirmationKey()
        Description copied from interface: AccessToken
        Get's the tokens confirmation claim.
        Specified by:
        getConfirmationKey in interface AccessToken
        Returns:
        the JSON confirmation key
      • setConfirmationKey

        protected void setConfirmationKey​(org.forgerock.json.JsonValue confirmationKey)
        Sets the confirmation key.
        Parameters:
        confirmationKey - the non-null JSON confirmation key
      • toMap

        public Map<String,​Object> toMap()
        Description copied from interface: Token
        Converts the token into a Map of its key data.
        Specified by:
        toMap in interface AccessToken
        Specified by:
        toMap in interface Token
        Returns:
        A Map of the token's key data.
      • getTokenInfo

        public Map<String,​Object> getTokenInfo()
        Description copied from interface: Token
        Gets the token's information.
        Specified by:
        getTokenInfo in interface Token
        Returns:
        A Map of the token's information.
      • addExtraData

        public void addExtraData​(String key,
                                 String value)

        Adds additional data to the Access Token.

        If the value is null then this method will ensure that the key is not present in the map.

        Specified by:
        addExtraData in interface AccessToken
        Parameters:
        key - The key.
        value - The value.
      • setAuditTrackingId

        protected void setAuditTrackingId​(String auditId)
        Sets the audit id.
        Parameters:
        auditId - The audit id.
      • setAuthTime

        protected void setAuthTime​(long authTime)
        Sets the end user's original authentication time in seconds since epoch.
        Overrides:
        setAuthTime in class StatefulToken
        Parameters:
        authTime - The authentication time.
      • toString

        public String toString()
        Overrides:
        toString in class org.forgerock.json.JsonValue