Package com.nimbusds.oauth2.sdk
Class AuthorizationCodeGrant
java.lang.Object
com.nimbusds.oauth2.sdk.AuthorizationGrant
com.nimbusds.oauth2.sdk.AuthorizationCodeGrant
Authorisation code grant. Used in access token requests with an
authorisation code.
Related specifications:
- OAuth 2.0 (RFC 6749)
- Proof Key for Code Exchange by OAuth Public Clients (RFC 7636)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizationCodeGrant
(AuthorizationCode code, URI redirectURI) Creates a new authorisation code grant.AuthorizationCodeGrant
(AuthorizationCode code, URI redirectURI, CodeVerifier codeVerifier) Creates a new authorisation code grant. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the authorisation code.Gets the authorisation code verifier for PKCE.Gets the redirection URI of the original authorisation request.int
hashCode()
static AuthorizationCodeGrant
Parses an authorisation code grant from the specified request body parameters.Returns the request body parameters for the authorisation grant.Methods inherited from class com.nimbusds.oauth2.sdk.AuthorizationGrant
getType
-
Field Details
-
GRANT_TYPE
The grant type.
-
-
Constructor Details
-
AuthorizationCodeGrant
Creates a new authorisation code grant.- Parameters:
code
- The authorisation code. Must not benull
.redirectURI
- The redirection URI of the original authorisation request. Required if the {redirect_uri} parameter was included in the authorisation request, elsenull
.
-
AuthorizationCodeGrant
Creates a new authorisation code grant.- Parameters:
code
- The authorisation code. Must not benull
.redirectURI
- The redirection URI of the original authorisation request. Required if the {redirect_uri} parameter was included in the authorisation request, elsenull
.codeVerifier
- The authorisation code verifier for PKCE,null
if not specified.
-
-
Method Details
-
getAuthorizationCode
Gets the authorisation code.- Returns:
- The authorisation code.
-
getRedirectionURI
Gets the redirection URI of the original authorisation request.- Returns:
- The redirection URI,
null
if theredirect_uri
parameter was not included in the original authorisation request.
-
getCodeVerifier
Gets the authorisation code verifier for PKCE.- Returns:
- The authorisation code verifier,
null
if not specified.
-
toParameters
Description copied from class:AuthorizationGrant
Returns the request body parameters for the authorisation grant.- Specified by:
toParameters
in classAuthorizationGrant
- Returns:
- The parameters.
-
equals
-
hashCode
-
parse
Parses an authorisation code grant from the specified request body parameters.Example:
grant_type=authorization_code code=SplxlOBeZQQYbYS6WxSbIA redirect_uri=https://Fclient.example.com/cb
- Parameters:
params
- The parameters.- Returns:
- The authorisation code grant.
- Throws:
ParseException
- If parsing failed.
-