public class ScriptBasedOIDCProtocolMapper extends AbstractOIDCProtocolMapper implements OIDCAccessTokenMapper, OIDCIDTokenMapper, UserInfoTokenMapper, EnvironmentDependentProviderFactory
ProtocolMapper
that uses a provided JavaScript fragment to compute the token claim value.Modifier and Type | Field and Description |
---|---|
static String |
PROVIDER_ID |
TOKEN_MAPPER_CATEGORY
Constructor and Description |
---|
ScriptBasedOIDCProtocolMapper() |
Modifier and Type | Method and Description |
---|---|
static ProtocolMapperModel |
create(String name,
String userAttribute,
String tokenClaimName,
String claimType,
boolean accessToken,
boolean idToken,
String script,
boolean multiValued) |
List<ProviderConfigProperty> |
getConfigProperties() |
String |
getDisplayCategory() |
String |
getDisplayType() |
String |
getHelpText() |
String |
getId() |
int |
getPriority()
Priority of this protocolMapper implementation.
|
protected String |
getScriptCode(ProtocolMapperModel mapperModel) |
boolean |
isSupported() |
protected void |
setClaim(IDToken token,
ProtocolMapperModel mappingModel,
UserSessionModel userSession,
KeycloakSession keycloakSession,
ClientSessionContext clientSessionCtx)
Intended to be overridden in
ProtocolMapper implementations to add claims to an token. |
void |
validateConfig(KeycloakSession session,
RealmModel realm,
ProtocolMapperContainerModel client,
ProtocolMapperModel mapperModel)
Called when instance of mapperModel is created/updated for this protocolMapper through admin endpoint
|
close, create, getProtocol, init, postInit, setClaim, transformAccessToken, transformIDToken, transformUserInfoToken
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
transformAccessToken
transformIDToken
transformUserInfoToken
order
public static final String PROVIDER_ID
public List<ProviderConfigProperty> getConfigProperties()
getConfigProperties
in interface ConfiguredProvider
public String getId()
getId
in interface ProviderFactory<ProtocolMapper>
public String getDisplayType()
getDisplayType
in interface ProtocolMapper
public String getDisplayCategory()
getDisplayCategory
in interface ProtocolMapper
public String getHelpText()
getHelpText
in interface ConfiguredProvider
public boolean isSupported()
isSupported
in interface EnvironmentDependentProviderFactory
true
if the provider is supported and should be available, false
otherwisepublic int getPriority()
ProtocolMapper
getPriority
in interface ProtocolMapper
protected void setClaim(IDToken token, ProtocolMapperModel mappingModel, UserSessionModel userSession, KeycloakSession keycloakSession, ClientSessionContext clientSessionCtx)
AbstractOIDCProtocolMapper
ProtocolMapper
implementations to add claims to an token.setClaim
in class AbstractOIDCProtocolMapper
public void validateConfig(KeycloakSession session, RealmModel realm, ProtocolMapperContainerModel client, ProtocolMapperModel mapperModel) throws ProtocolMapperConfigException
ProtocolMapper
validateConfig
in interface ProtocolMapper
client
- client or clientTemplateProtocolMapperConfigException
- if configuration provided in mapperModel is not validprotected String getScriptCode(ProtocolMapperModel mapperModel)
Copyright © 2020 JBoss by Red Hat. All rights reserved.