Class AbstractTokenExchangeProvider
java.lang.Object
org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
- All Implemented Interfaces:
TokenExchangeProvider
,Provider
- Direct Known Subclasses:
FederatedTokenExchangeProvider
,StandardTokenExchangeProvider
,SubjectImpersonationTokenExchangeProvider
,V1TokenExchangeProvider
Base token exchange implementation. For now for both V1 and V2 token exchange (may change in the follow-up commits)
- Author:
- Dmitry Telegin
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClientModel
protected ClientConnection
protected TokenExchangeContext
protected Cors
protected EventBuilder
protected jakarta.ws.rs.core.HttpHeaders
protected TokenExchangeContext.Params
protected RealmModel
protected KeycloakSession
protected TokenManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected AuthenticationSessionModel
createSessionModel
(UserSessionModel targetUserSession, RootAuthenticationSessionModel rootAuthSession, UserModel targetUser, ClientModel client, String scope) jakarta.ws.rs.core.Response
exchange
(TokenExchangeContext context) Exchange thetoken
.protected jakarta.ws.rs.core.Response
exchangeClientToClient
(UserModel targetUser, UserSessionModel targetUserSession, AccessToken token, boolean disallowOnHolderOfTokenMismatch) protected jakarta.ws.rs.core.Response
exchangeClientToOIDCClient
(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope) protected jakarta.ws.rs.core.Response
exchangeClientToSAML2Client
(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) protected jakarta.ws.rs.core.Response
exchangeExternalToken
(String subjectIssuer, String subjectToken) protected jakarta.ws.rs.core.Response
exchangeToIdentityProvider
(UserModel targetUser, UserSessionModel targetUserSession, String requestedIssuer) protected void
forbiddenIfClientIsNotTokenHolder
(boolean disallowOnHolderOfTokenMismatch, ClientModel tokenHolder) protected void
protected String
getRequestedScope
(AccessToken token, List<ClientModel> targetAudienceClients) protected String
protected String
getSubjectIssuer
(TokenExchangeContext context, String subjectToken, String subjectTokenType) protected List<ClientModel>
protected ClientModel
getTargetClient
(List<ClientModel> targetAudienceClients) protected UserModel
protected boolean
Is it the request for external-internal token exchange?protected void
setClientToContext
(List<ClientModel> targetAudienceClients) protected abstract jakarta.ws.rs.core.Response
protected void
updateUserSessionFromClientAuth
(UserSessionModel userSession) protected void
validateAudience
(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.protocol.oidc.TokenExchangeProvider
supports
-
Field Details
-
params
-
formParams
-
session
-
cors
-
realm
-
client
-
event
-
clientConnection
-
headers
protected jakarta.ws.rs.core.HttpHeaders headers -
tokenManager
-
clientAuthAttributes
-
context
-
-
Constructor Details
-
AbstractTokenExchangeProvider
public AbstractTokenExchangeProvider()
-
-
Method Details
-
exchange
Description copied from interface:TokenExchangeProvider
Exchange thetoken
.- Specified by:
exchange
in interfaceTokenExchangeProvider
- Returns:
- response with a new token
-
close
public void close() -
tokenExchange
protected abstract jakarta.ws.rs.core.Response tokenExchange() -
isExternalInternalTokenExchangeRequest
Is it the request for external-internal token exchange? -
getSubjectIssuer
protected String getSubjectIssuer(TokenExchangeContext context, String subjectToken, String subjectTokenType) -
exchangeToIdentityProvider
protected jakarta.ws.rs.core.Response exchangeToIdentityProvider(UserModel targetUser, UserSessionModel targetUserSession, String requestedIssuer) -
getRequestedTokenType
-
getTargetAudienceClients
-
validateAudience
protected void validateAudience(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) -
exchangeClientToClient
protected jakarta.ws.rs.core.Response exchangeClientToClient(UserModel targetUser, UserSessionModel targetUserSession, AccessToken token, boolean disallowOnHolderOfTokenMismatch) -
forbiddenIfClientIsNotWithinTokenAudience
-
forbiddenIfClientIsNotTokenHolder
protected void forbiddenIfClientIsNotTokenHolder(boolean disallowOnHolderOfTokenMismatch, ClientModel tokenHolder) -
getSupportedOAuthResponseTokenTypes
-
createSessionModel
protected AuthenticationSessionModel createSessionModel(UserSessionModel targetUserSession, RootAuthenticationSessionModel rootAuthSession, UserModel targetUser, ClientModel client, String scope) -
getRequestedScope
-
setClientToContext
-
getTargetClient
-
exchangeClientToOIDCClient
protected jakarta.ws.rs.core.Response exchangeClientToOIDCClient(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope) -
exchangeClientToSAML2Client
protected jakarta.ws.rs.core.Response exchangeClientToSAML2Client(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) -
exchangeExternalToken
-
importUserFromExternalIdentity
-
updateUserSessionFromClientAuth
-