org.keycloak.protocol.oidc.mappers

## Class UserRealmRoleMappingMapper

- java.lang.Object
- - org.keycloak.protocol.oidc.mappers.AbstractOIDCProtocolMapper
  - - org.keycloak.protocol.oidc.mappers.UserRealmRoleMappingMapper

- All Implemented Interfaces:
    OIDCAccessTokenMapper, OIDCIDTokenMapper, ProtocolMapper, ConfiguredProvider, Provider, ProviderFactory<ProtocolMapper>

      public class UserRealmRoleMappingMapper
      extends AbstractOIDCProtocolMapper

  Allows mapping of user realm role mappings to an ID and Access Token claim.
  Author:
    Thomas Darimont

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PROVIDER_ID`

    - ### Fields inherited from class org.keycloak.protocol.oidc.mappers.AbstractOIDCProtocolMapper

      `TOKEN_MAPPER_CATEGORY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserRealmRoleMappingMapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Set<String>` | `flattenRoleModelToRoleNames(Set<RoleModel> roleModels, String prefix)` Returns the role names extracted from the given `roleModels` while recursively traversing "Composite Roles".
    `List<ProviderConfigProperty>` | `getConfigProperties()`
    `String` | `getDisplayCategory()`
    `String` | `getDisplayType()`
    `String` | `getHelpText()`
    `String` | `getId()`
    `protected void` | `setClaim(IDToken token, ProtocolMapperModel mappingModel, UserSessionModel userSession)`
    `AccessToken` | `transformAccessToken(AccessToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, ClientSessionModel clientSession)`
    `IDToken` | `transformIDToken(IDToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, ClientSessionModel clientSession)`

    - ### Methods inherited from class org.keycloak.protocol.oidc.mappers.AbstractOIDCProtocolMapper

      `close, create, getProtocol, init, postInit`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROVIDER_ID

          public static final String PROVIDER_ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UserRealmRoleMappingMapper

          public UserRealmRoleMappingMapper()

  - ### Method Detail

    - #### getConfigProperties

          public List<ProviderConfigProperty> getConfigProperties()

    - #### getId

          public String getId()

    - #### getDisplayType

          public String getDisplayType()

    - #### getDisplayCategory

          public String getDisplayCategory()

    - #### getHelpText

          public String getHelpText()

    - #### setClaim

          protected void setClaim(IDToken token,
                                  ProtocolMapperModel mappingModel,
                                  UserSessionModel userSession)

    - #### transformAccessToken

          public AccessToken transformAccessToken(AccessToken token,
                                                  ProtocolMapperModel mappingModel,
                                                  KeycloakSession session,
                                                  UserSessionModel userSession,
                                                  ClientSessionModel clientSession)

      Specified by:
        `transformAccessToken` in interface `OIDCAccessTokenMapper`

    - #### transformIDToken

          public IDToken transformIDToken(IDToken token,
                                          ProtocolMapperModel mappingModel,
                                          KeycloakSession session,
                                          UserSessionModel userSession,
                                          ClientSessionModel clientSession)

      Specified by:
        `transformIDToken` in interface `OIDCIDTokenMapper`

    - #### flattenRoleModelToRoleNames

          protected Set<String> flattenRoleModelToRoleNames(Set<RoleModel> roleModels,
                                                            String prefix)

      Returns the role names extracted from the given `roleModels` while recursively traversing "Composite Roles".

      Optionally prefixes each role name with the given `prefix`.

      Parameters:
        `roleModels` -
        `prefix` - the prefix to apply, may be null
      Returns:

Copyright © 2016 JBoss by Red Hat. All rights reserved.