Class AuthorizationCode

  • All Implemented Interfaces:
    Cloneable, Iterable<org.forgerock.json.JsonValue>, Token

    public class AuthorizationCode
    extends org.forgerock.json.JsonValue
    implements Token
    Models a OAuth2 Authorization Code.
    Since:
    12.0.0
    • Constructor Detail

      • AuthorizationCode

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

        public AuthorizationCode​(String code,
                                 String resourceOwnerId,
                                 String clientId,
                                 String redirectUri,
                                 Set<String> scope,
                                 String claims,
                                 long expiryTime,
                                 String nonce,
                                 String realm,
                                 String authModules,
                                 String acr,
                                 String ssoTokenId,
                                 String codeChallenge,
                                 String codeChallengeMethod,
                                 String authGrantId,
                                 String auditId)
        Constructs a new AuthorizationCode.
        Parameters:
        code - The authorization code.
        resourceOwnerId - The resource owner's id.
        clientId - The client's id.
        redirectUri - The redirect uri.
        scope - The scopes.
        expiryTime - The expiry time.
        nonce - The nonce.
    • Method Detail

      • isExpired

        public final boolean isExpired()
        Determines if the Authorization Code is expired.
        Returns:
        true if current time is greater than the expiry time.
      • getExpiryTime

        public long getExpiryTime()
        Gets the expiry time.
        Returns:
        The Expiry time.
      • getTokenId

        public String getTokenId()
        Gets the token's identifier.
        Specified by:
        getTokenId in interface Token
        Returns:
        The token's id.
      • getTokenType

        public String getTokenType()
        Gets the token type.
        Returns:
        The token type.
      • getTokenName

        public String getTokenName()
        Gets the token's name.
        Specified by:
        getTokenName in interface Token
        Returns:
        The token's name.
      • getScope

        public Set<String> getScope()
        Gets the scope.
        Returns:
        The scope.
      • isIssued

        public boolean isIssued()
        Determines whether the authorization code has been issued.
        Returns:
        true if the authorization code has been issued.
      • getRedirectUri

        public String getRedirectUri()
        Gets the redirect uri.
        Returns:
        The redirect uri.
      • getClientId

        public String getClientId()
        Gets the client's id.
        Returns:
        The client's id.
      • getResourceOwnerId

        public String getResourceOwnerId()
        Gets the resource owner's id.
        Returns:
        The resource owner's id.
      • getAuthModules

        public String getAuthModules()
        Get the auth modules string.
        Returns:
        The pipe-separated list of auth modules.
      • getAuthenticationContextClassReference

        public String getAuthenticationContextClassReference()
        Get the Authentication Context Class Reference (acr).
        Returns:
        The acr string matched, if any.
      • getNonce

        public String getNonce()
        Gets the nonce.
        Returns:
        The nonce.
      • getSessionId

        public String getSessionId()
        Gets the session id of the authenticating session.
        Returns:
        The session id.
      • setIssued

        public void setIssued()
        Sets the authorization code as issued.
      • toMap

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

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

        public String getCodeChallenge()
        Get the code challenge
        Returns:
        code challenge
      • getCodeChallengeMethod

        public String getCodeChallengeMethod()
        Get the code challenge method
        Returns:
        code challenge method
      • getAuthGrantId

        public String getAuthGrantId()
        Gets the authorization grant id
        Returns:
        The authorization grant id
      • toJsonValue

        public org.forgerock.json.JsonValue toJsonValue()
        Gets the JsonValue representation of the token.
        Specified by:
        toJsonValue in interface Token
        Returns:
        The JsonValue representation of the token.
      • getAuditTrackingId

        public String getAuditTrackingId()
        Description copied from interface: Token
        Get the audit tracking ID for this token.
        Specified by:
        getAuditTrackingId in interface Token
        Returns:
        The tracking ID.
      • getClaims

        public String getClaims()
        Returns the requested claims.
        Returns:
        The requested claims.
      • getRealm

        public String getRealm()
        Gets the realm.
        Returns:
        The realm.