org.keycloak.broker.saml.mappers

## Class UsernameTemplateMapper

- java.lang.Object
- - org.keycloak.broker.provider.AbstractIdentityProviderMapper
  - - org.keycloak.broker.saml.mappers.UsernameTemplateMapper

- All Implemented Interfaces:
    IdentityProviderMapper, ConfiguredProvider, Provider, ProviderFactory<IdentityProviderMapper>

      public class UsernameTemplateMapper
      extends AbstractIdentityProviderMapper

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UsernameTemplateMapper.Target`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String[]` | `COMPATIBLE_PROVIDERS`
    `static String` | `PROVIDER_ID`
    `static String` | `TARGET`
    `static List<String>` | `TARGETS`
    `static String` | `TEMPLATE`
    `static Map<String,UnaryOperator<String>>` | `TRANSFORMERS`

    - ### Fields inherited from interface org.keycloak.broker.provider.IdentityProviderMapper

      `ANY_PROVIDER, DEFAULT_IDENTITY_PROVIDER_MAPPER_SYNC_MODES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UsernameTemplateMapper()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getCompatibleProviders()`
    `List<ProviderConfigProperty>` | `getConfigProperties()`
    `String` | `getDisplayCategory()`
    `String` | `getDisplayType()`
    `String` | `getHelpText()`
    `String` | `getId()`
    `static UsernameTemplateMapper.Target` | `getTarget(String value)`
    `void` | `preprocessFederatedIdentity(KeycloakSession session, RealmModel realm, IdentityProviderMapperModel mapperModel, BrokeredIdentityContext context)` Called to determine what keycloak username and email to use to process the login request from the external IDP.
    `boolean` | `supportsSyncMode(IdentityProviderSyncMode syncMode)`
    `void` | `updateBrokeredUser(KeycloakSession session, RealmModel realm, UserModel user, IdentityProviderMapperModel mapperModel, BrokeredIdentityContext context)` Called when this user has logged in before and has already been imported.
    `void` | `updateBrokeredUserLegacy(KeycloakSession session, RealmModel realm, UserModel user, IdentityProviderMapperModel mapperModel, BrokeredIdentityContext context)` Called when this user has logged in before and has already been imported.

    - ### Methods inherited from class org.keycloak.broker.provider.AbstractIdentityProviderMapper

      `close, create, importNewUser, init, postInit`

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

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

    - ### Methods inherited from interface org.keycloak.provider.ProviderFactory

      `order`

- - ### Field Detail

    - #### COMPATIBLE_PROVIDERS

          public static final String[] COMPATIBLE_PROVIDERS

    - #### TEMPLATE

          public static final String TEMPLATE

      See Also:
        Constant Field Values

    - #### TARGET

          public static final String TARGET

      See Also:
        Constant Field Values

    - #### TARGETS

          public static final List<String> TARGETS

    - #### TRANSFORMERS

          public static final Map<String,UnaryOperator<String>> TRANSFORMERS

    - #### PROVIDER_ID

          public static final String PROVIDER_ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UsernameTemplateMapper

          public UsernameTemplateMapper()

  - ### Method Detail

    - #### supportsSyncMode

          public boolean supportsSyncMode(IdentityProviderSyncMode syncMode)

    - #### getConfigProperties

          public List<ProviderConfigProperty> getConfigProperties()

    - #### getId

          public String getId()

    - #### getCompatibleProviders

          public String[] getCompatibleProviders()

    - #### getDisplayCategory

          public String getDisplayCategory()

    - #### getDisplayType

          public String getDisplayType()

    - #### updateBrokeredUserLegacy

          public void updateBrokeredUserLegacy(KeycloakSession session,
                                               RealmModel realm,
                                               UserModel user,
                                               IdentityProviderMapperModel mapperModel,
                                               BrokeredIdentityContext context)

      Description copied from interface: `IdentityProviderMapper`
      Called when this user has logged in before and has already been imported. Legacy behaviour. When updating the mapper to correctly update brokered users in all sync modes, move the old behavior into this method.
      Specified by:
        `updateBrokeredUserLegacy` in interface `IdentityProviderMapper`
      Overrides:
        `updateBrokeredUserLegacy` in class `AbstractIdentityProviderMapper`

    - #### updateBrokeredUser

          public void updateBrokeredUser(KeycloakSession session,
                                         RealmModel realm,
                                         UserModel user,
                                         IdentityProviderMapperModel mapperModel,
                                         BrokeredIdentityContext context)

      Description copied from interface: `IdentityProviderMapper`
      Called when this user has logged in before and has already been imported.
      Specified by:
        `updateBrokeredUser` in interface `IdentityProviderMapper`
      Overrides:
        `updateBrokeredUser` in class `AbstractIdentityProviderMapper`

    - #### preprocessFederatedIdentity

          public void preprocessFederatedIdentity(KeycloakSession session,
                                                  RealmModel realm,
                                                  IdentityProviderMapperModel mapperModel,
                                                  BrokeredIdentityContext context)

      Description copied from interface: `IdentityProviderMapper`
      Called to determine what keycloak username and email to use to process the login request from the external IDP. It's called before "FirstBrokerLogin" flow, so can be used to map attributes to BrokeredIdentityContext ( BrokeredIdentityContext.setUserAttribute ), which will be available on "Review Profile" page and in authenticators during FirstBrokerLogin flow
      Specified by:
        `preprocessFederatedIdentity` in interface `IdentityProviderMapper`
      Overrides:
        `preprocessFederatedIdentity` in class `AbstractIdentityProviderMapper`

    - #### getHelpText

          public String getHelpText()

    - #### getTarget

          public static UsernameTemplateMapper.Target getTarget(String value)

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