Class V1TokenExchangeProvider
java.lang.Object
org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
org.keycloak.protocol.oidc.tokenexchange.V1TokenExchangeProvider
- All Implemented Interfaces:
TokenExchangeProvider
,Provider
- Direct Known Subclasses:
ExternalToInternalTokenExchangeProvider
V1 token exchange provider. Supports all token exchange types (standard, federated, subject impersonation)
- Author:
- Dmitry Telegin
-
Field Summary
Fields inherited from class org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
client, clientAuthAttributes, clientConnection, context, cors, event, formParams, headers, params, realm, session, tokenManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.ws.rs.core.Response
exchangeClientToOIDCClient
(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope, AccessToken subjectToken) protected jakarta.ws.rs.core.Response
exchangeClientToSAML2Client
(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) protected String
getRequestedScope
(AccessToken token, List<ClientModel> targetAudienceClients) protected String
protected ClientModel
getTargetClient
(List<ClientModel> targetAudienceClients) int
protected void
setClientToContext
(List<ClientModel> targetAudienceClients) boolean
supports
(TokenExchangeContext context) Check if exchange request is supported by this providerprotected jakarta.ws.rs.core.Response
protected void
validateAudience
(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) Methods inherited from class org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
close, createSessionModel, exchange, exchangeClientToClient, exchangeExternalToken, exchangeToIdentityProvider, forbiddenIfClientIsNotTokenHolder, forbiddenIfClientIsNotWithinTokenAudience, getSubjectIssuer, getTargetAudienceClients, importUserFromExternalIdentity, isExternalInternalTokenExchangeRequest, updateUserSessionFromClientAuth
-
Constructor Details
-
V1TokenExchangeProvider
public V1TokenExchangeProvider()
-
-
Method Details
-
getVersion
public int getVersion()- Returns:
- version of the token-exchange provider. Could be useful by various components (like for example identity-providers), which need to interact with the token-exchange provider to doublecheck if it should have a "legacy" behaviour (for older version of token-exchange provider) or a "new" behaviour
-
supports
Description copied from interface:TokenExchangeProvider
Check if exchange request is supported by this provider- Parameters:
context
- token exchange context- Returns:
- true if the request is supported
-
tokenExchange
protected jakarta.ws.rs.core.Response tokenExchange()- Specified by:
tokenExchange
in classAbstractTokenExchangeProvider
-
getRequestedTokenType
- Specified by:
getRequestedTokenType
in classAbstractTokenExchangeProvider
-
validateAudience
protected void validateAudience(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) - Specified by:
validateAudience
in classAbstractTokenExchangeProvider
-
getSupportedOAuthResponseTokenTypes
- Specified by:
getSupportedOAuthResponseTokenTypes
in classAbstractTokenExchangeProvider
-
getRequestedScope
- Specified by:
getRequestedScope
in classAbstractTokenExchangeProvider
-
setClientToContext
- Overrides:
setClientToContext
in classAbstractTokenExchangeProvider
-
getTargetClient
-
exchangeClientToOIDCClient
protected jakarta.ws.rs.core.Response exchangeClientToOIDCClient(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope, AccessToken subjectToken) - Specified by:
exchangeClientToOIDCClient
in classAbstractTokenExchangeProvider
-
exchangeClientToSAML2Client
protected jakarta.ws.rs.core.Response exchangeClientToSAML2Client(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) - Specified by:
exchangeClientToSAML2Client
in classAbstractTokenExchangeProvider
-