Class SaslMapping

java.lang.Object
com.isode.dsapi.util.SaslMapping

public class SaslMapping extends Object
SASL ID to directory mapping (non-GSSAPI - generic only).

This class reads current directory SASL configuration and provides conversion SASL ID <-> DN.

Provides methods required to create user entries based on SASL ID:

Since:
15.0
Author:
mst
  • Constructor Details

    • SaslMapping

      public SaslMapping(DirectorySession ds, SaslConfiguration sasl)
      Creates a SaslMapping and tests/verifies current SASL mapping configuration and throws an exception on any problems
      Parameters:
      ds - directory session (not null)
      sasl - SASL configuration (not null)
  • Method Details

    • sasl2DN

      public DN sasl2DN(String id, DN baseDN) throws SaslException
      Converts SASL user ID (email) to current mapping style DN.

      Only for Active Directory mapping schema this conversion is reliable for user entry searching as there is only one possible DN for ID mapping. For all other search mapping styles returned result is only the simplest possible DN. Generally for non AD mappings this method cannot be used to search existing user entry - saslUserSearch() method have to be used for such operation! This method however can be used to select DN for new created user entries as it returns valid DN according to currently set mapping schema.

      Parameters:
      id - SASL user ID (email) (not null)
      baseDN - base DN - for null will use generic base DN specified in SASL configuration (ignored by active directory schema)
      Returns:
      DN, null if email is incorrect
      Throws:
      SaslException - when both alternate and generic base DN are not specified and at least one is required (in non AD mappings)
    • searchUserEntry

      public Entry searchUserEntry(String id, Selection sel, CommonArgs ca) throws DSAPIException
      Searches user Entry for given SASL user ID (email) according to current mapping schema.
      Parameters:
      id - SASL user ID (email)
      sel - Selection (@see com.isode.dsapi.DirectorySession.search())
      ca - CommonArgs (@see com.isode.dsapi.DirectorySession.search())
      Returns:
      Entry, null if email is incorrect or entry not found
      Throws:
      DSAPIException
    • userEntry2SaslId

      public String userEntry2SaslId(Entry uentry) throws SaslException, DSAPIException
      Resolve SASL user ID for specific user entry using current mapping style
      Parameters:
      uentry - users entry
      Returns:
      SASL user ID (email address), null if entry doesn't match to SASL configuration
      Throws:
      SaslException - if given entry doesn't match to current SASL configuration
      DSAPIException
    • prepareUserParent

      public void prepareUserParent(String domain, Attribute domainObjectClassesAttribute, Attribute containerObjectClassesAttribute) throws DSAPIException, SaslException
      Prepare user domain entries and glue entry for current mapping schema (if required)
      Parameters:
      domain -
      domainObjectClassesAttribute -
      containerObjectClassesAttribute -
      Throws:
      DSAPIException
      SaslException
    • getUserAttributeType

      public AttributeType getUserAttributeType()
      Returns user entry attribute type used by SASL ID in current mapping.
      Returns:
      user entry attribute type used by SASL ID (not null)
      Since:
      16.0;