public interface RoleMappingsProvider
META-INF/services/org.keycloak.adapters.saml.RoleMappingsProvider
file
containing the FQN of the custom implementation class must be added to the WAR that contains the provider implementation
class (or the JAR that is attached to the WEB-INF/lib
or as a jboss module
if one wants to share the
implementation among more WARs).
The role mappings provider implementation that will be selected for the SP application is identified in the keycloak-saml.xml
by its id. The provider declaration can also contain one or more configuration properties that will be passed to the implementation
in the {@link #init(SamlDeployment, ResourceLoader, Properties)}
method. For example, if an LDAP-based implementation
with id ldap-based-role-mapper
is made available via META-INF/services
, it can be selected in keycloak-saml.xml
as follows:
...NOTE: The SPI is not yet finished and method signatures are still subject to change in future versions.... ...
Modifier and Type | Method and Description |
---|---|
String |
getId()
Obtains the provider's identifier.
|
void |
init(SamlDeployment deployment,
ResourceLoader loader,
Properties config)
Initializes the provider.
|
Set<String> |
map(String principalName,
Set<String> roles)
Produces the final set of roles that should be assigned to the specified principal.
|
String getId()
keycloak-saml.xml
to identify the provider implementation
to be used.String
representing the provider's id.void init(SamlDeployment deployment, ResourceLoader loader, Properties config)
keycloak-saml.xml
have been parsed and a provider whose id matches the one in the descriptor is successfully loaded.deployment
- a reference to the constructed SamlDeployment
.loader
- a reference to a ResourceLoader
that can be used to load additional resources from the WAR.config
- a Properties
object containing the provider config as read from keycloak-saml.xml
Set<String> map(String principalName, Set<String> roles)
principalName
- the principal name as extracted from the SAML assertion.roles
- the set of roles extracted from the SAML assertion.Set
containing the final set of roles that are to be assigned to the principal.Copyright © 2021 JBoss by Red Hat. All rights reserved.