Class OAuth2GrantTypeBase
java.lang.Object
org.keycloak.protocol.oidc.grants.OAuth2GrantTypeBase
- All Implemented Interfaces:
OAuth2GrantType,Provider
- Direct Known Subclasses:
AuthorizationCodeGrantType,CibaGrantType,ClientCredentialsGrantType,DeviceGrantType,PermissionGrantType,PreAuthorizedCodeGrantType,RefreshTokenGrantType,ResourceOwnerPasswordCredentialsGrantType,TokenExchangeGrantType
Base class for OAuth 2.0 grant types
- Author:
- Dmitry Telegin (et al.)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.protocol.oidc.grants.OAuth2GrantType
OAuth2GrantType.Context -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClientModelprotected OIDCAdvancedConfigWrapperprotected ClientConnectionprotected OAuth2GrantType.Contextprotected Corsprotected EventBuilderprotected jakarta.ws.rs.core.HttpHeadersprotected RealmModelprotected HttpRequestprotected HttpResponseprotected KeycloakSessionprotected TokenManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomTokenResponseClaims(org.keycloak.representations.AccessTokenResponse res, ClientSessionContext clientSessionCtx) Extension point for subclasses to add custom claims to the AccessTokenResponse before it is returned.protected voidcheckAndBindMtlsHoKToken(TokenManager.AccessTokenResponseBuilder responseBuilder, boolean useRefreshToken) protected voidvoidclose()protected jakarta.ws.rs.core.ResponsecreateTokenResponse(UserModel user, UserSessionModel userSession, ClientSessionContext clientSessionCtx, String scopeParam, boolean code, Function<TokenManager.AccessTokenResponseBuilder, ClientPolicyContext> clientPolicyContextGenerator) protected Stringprotected List<AuthorizationDetailsResponse>handleMissingAuthorizationDetails(UserSessionModel userSession, ClientSessionContext clientSessionCtx) Handle missing authorization_details parameter by allowing processors to generate authorization details response.protected List<AuthorizationDetailsResponse>processAuthorizationDetails(UserSessionModel userSession, ClientSessionContext clientSessionCtx) Processes the authorization_details parameter using provider discovery.protected voidsetContext(OAuth2GrantType.Context context) protected voidupdateClientSession(AuthenticatedClientSessionModel clientSession) protected voidupdateUserSessionFromClientAuth(UserSessionModel userSession) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.protocol.oidc.grants.OAuth2GrantType
getEventType, getSupportedMultivaluedRequestParameters, process
-
Field Details
-
context
-
session
-
realm
-
client
-
clientConfig
-
clientConnection
-
clientAuthAttributes
-
formParams
-
event
-
cors
-
tokenManager
-
request
-
response
-
headers
protected jakarta.ws.rs.core.HttpHeaders headers
-
-
Constructor Details
-
OAuth2GrantTypeBase
public OAuth2GrantTypeBase()
-
-
Method Details
-
setContext
-
createTokenResponse
protected jakarta.ws.rs.core.Response createTokenResponse(UserModel user, UserSessionModel userSession, ClientSessionContext clientSessionCtx, String scopeParam, boolean code, Function<TokenManager.AccessTokenResponseBuilder, ClientPolicyContext> clientPolicyContextGenerator) -
checkAndBindMtlsHoKToken
protected void checkAndBindMtlsHoKToken(TokenManager.AccessTokenResponseBuilder responseBuilder, boolean useRefreshToken) -
updateClientSession
-
updateUserSessionFromClientAuth
-
getRequestedScopes
-
checkClient
protected void checkClient() -
addCustomTokenResponseClaims
protected void addCustomTokenResponseClaims(org.keycloak.representations.AccessTokenResponse res, ClientSessionContext clientSessionCtx) Extension point for subclasses to add custom claims to the AccessTokenResponse before it is returned. Default implementation does nothing. -
processAuthorizationDetails
protected List<AuthorizationDetailsResponse> processAuthorizationDetails(UserSessionModel userSession, ClientSessionContext clientSessionCtx) Processes the authorization_details parameter using provider discovery. This method can be overridden by subclasses to customize the behavior.- Parameters:
userSession- the user sessionclientSessionCtx- the client session context- Returns:
- the authorization details response if processing was successful, null otherwise
-
handleMissingAuthorizationDetails
protected List<AuthorizationDetailsResponse> handleMissingAuthorizationDetails(UserSessionModel userSession, ClientSessionContext clientSessionCtx) Handle missing authorization_details parameter by allowing processors to generate authorization details response. This is used in Pre-Authorized Code Flow where the credential offer contains the authorized credential configuration IDs.- Parameters:
userSession- the user sessionclientSessionCtx- the client session context- Returns:
- the authorization details response if generation was successful, null otherwise
-
close
public void close()
-