Class StandardTokenExchangeProvider
java.lang.Object
org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
org.keycloak.protocol.oidc.tokenexchange.StandardTokenExchangeProvider
- All Implemented Interfaces:
TokenExchangeProvider,Provider
- Direct Known Subclasses:
ExternalToInternalTokenExchangeProvider
Provider for internal-internal token exchange, which is compliant with the token exchange specification https://datatracker.ietf.org/doc/html/rfc8693
- Author:
- Marek Posolda
-
Nested Class Summary
Nested classes/interfaces inherited from class org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
AbstractTokenExchangeProvider.ExternalExchangeContext -
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 voidcheckRequestedAudiences(TokenManager.AccessTokenResponseBuilder responseBuilder) protected jakarta.ws.rs.core.ResponseexchangeClientToOIDCClient(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope, AccessToken subjectToken) protected jakarta.ws.rs.core.ResponseexchangeClientToSAML2Client(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) protected StringgetRequestedScope(AccessToken token, List<ClientModel> targetAudienceClients) protected Stringintbooleansupports(TokenExchangeContext context) Check if exchange request is supported by this providerprotected jakarta.ws.rs.core.Responseprotected voidvalidateAudience(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) protected voidvalidateConsents(UserModel targetUser, ClientSessionContext clientSessionCtx) Methods inherited from class org.keycloak.protocol.oidc.tokenexchange.AbstractTokenExchangeProvider
close, createSessionModel, exchange, exchangeClientToClient, exchangeExternalToken, exchangeToIdentityProvider, forbiddenIfClientIsNotTokenHolder, forbiddenIfClientIsNotWithinTokenAudience, getSubjectIssuer, getTargetAudienceClients, importUserFromExternalIdentity, isExternalInternalTokenExchangeRequest, locateExchangeExternalTokenByAlias, setClientToContext, updateUserSessionFromClientAuth
-
Constructor Details
-
StandardTokenExchangeProvider
public StandardTokenExchangeProvider()
-
-
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:TokenExchangeProviderCheck 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:
tokenExchangein classAbstractTokenExchangeProvider
-
validateAudience
protected void validateAudience(AccessToken token, boolean disallowOnHolderOfTokenMismatch, List<ClientModel> targetAudienceClients) - Specified by:
validateAudiencein classAbstractTokenExchangeProvider
-
validateConsents
-
getRequestedScope
- Specified by:
getRequestedScopein classAbstractTokenExchangeProvider
-
exchangeClientToOIDCClient
protected jakarta.ws.rs.core.Response exchangeClientToOIDCClient(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients, String scope, AccessToken subjectToken) - Specified by:
exchangeClientToOIDCClientin classAbstractTokenExchangeProvider
-
exchangeClientToSAML2Client
protected jakarta.ws.rs.core.Response exchangeClientToSAML2Client(UserModel targetUser, UserSessionModel targetUserSession, String requestedTokenType, List<ClientModel> targetAudienceClients) - Specified by:
exchangeClientToSAML2Clientin classAbstractTokenExchangeProvider
-
checkRequestedAudiences
-
getSupportedOAuthResponseTokenTypes
- Specified by:
getSupportedOAuthResponseTokenTypesin classAbstractTokenExchangeProvider
-
getRequestedTokenType
- Specified by:
getRequestedTokenTypein classAbstractTokenExchangeProvider
-