Class IdentityMapper<T extends IdentityMapperCfg>

java.lang.Object
org.opends.server.api.IdentityMapper<T>
Type Parameters:
T - The type of configuration handled by this identity mapper.
Direct Known Subclasses:
ExactMatchIdentityMapper, RegularExpressionIdentityMapper

public abstract class IdentityMapper<T extends IdentityMapperCfg> extends Object
This class defines the set of methods and structures that must be implemented by a Directory Server identity mapper. An identity mapper is used to identify exactly one user associated with a given identification value. This API may be used by a number of SASL mechanisms to identify the user that is authenticating to the server. It may also be used in other areas, like in conjunction with the proxied authorization control.
  • Constructor Details

    • IdentityMapper

      public IdentityMapper()
  • Method Details

    • initializeIdentityMapper

      public abstract void initializeIdentityMapper(T configuration) throws ConfigException, InitializationException
      Initializes this identity mapper based on the information in the provided configuration entry.
      Parameters:
      configuration - The configuration for the identity mapper.
      Throws:
      ConfigException - If an unrecoverable problem arises in the process of performing the initialization.
      InitializationException - If a problem occurs during initialization that is not related to the server configuration.
    • isConfigurationAcceptable

      public boolean isConfigurationAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons)
      Indicates whether the provided configuration is acceptable for this identity mapper. It should be possible to call this method on an uninitialized identity mapper instance in order to determine whether the identity mapper would be able to use the provided configuration.
      Parameters:
      configuration - The identity mapper configuration for which to make the determination.
      unacceptableReasons - A list that may be used to hold the reasons that the provided configuration is not acceptable.
      Returns:
      true if the provided configuration is acceptable for this identity mapper, or false if not.
    • finalizeIdentityMapper

      public void finalizeIdentityMapper()
      Performs any finalization that may be necessary for this identity mapper. By default, no finalization is performed.
    • getEntryForID

      protected abstract Entry getEntryForID(String id) throws LdapException
      Retrieves the user entry that was mapped to the provided identification string.
      Parameters:
      id - The identification string that is to be mapped to a user.
      Returns:
      The user entry that was mapped to the provided identification, or null if no users were found that could be mapped to the provided ID.
      Throws:
      LdapException - If a problem occurs while attempting to map the given ID to a user entry, or if there are multiple user entries that could map to the provided ID.
    • getEntryForID

      public static Entry getEntryForID(String id, List<IdentityMapper<?>> identityMappers) throws LdapException
      Retrieves the user entry that was mapped to the provided identification string from a list of IdentityMappers. The strategy is first found, first returned: the first identity mapper of the given list, that returns a non-null entry, wins.
      Parameters:
      id - The identification string that is to be mapped to a user.
      identityMappers - The list of the identity mappers that could map the given id to a user.
      Returns:
      The user entry that was mapped to the provided identification, or null if no users were found that could be mapped to the provided ID.
      Throws:
      LdapException - If a problem occurs while attempting to map the given ID to a user entry, or if there are multiple user entries that could map to the provided ID.
    • getServerContext

      protected ServerContext getServerContext()
      Returns the server context.
      Returns:
      the server context
    • setServerContext

      public void setServerContext(ServerContext serverContext)
      Sets the server context.
      Parameters:
      serverContext - the server context