Package com.isode.dsapi.util
Class SaslMapping
java.lang.Object
com.isode.dsapi.util.SaslMapping
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:
sasl2DN(String, DN)
- converting SASL ID to simplest DN matching current mapping rule/styleprepareUserParent(String, Attribute, Attribute)
- preparing domain/container entries in the DIT being parent entries to related user entry)
- Since:
- 15.0
- Author:
- mst
-
Constructor Summary
ConstructorsConstructorDescriptionSaslMapping
(DirectorySession ds, SaslConfiguration sasl) Creates a SaslMapping and tests/verifies current SASL mapping configuration and throws an exception on any problems -
Method Summary
Modifier and TypeMethodDescriptionReturns user entry attribute type used by SASL ID in current mapping.void
prepareUserParent
(String domain, Attribute domainObjectClassesAttribute, Attribute containerObjectClassesAttribute) Prepare user domain entries and glue entry for current mapping schema (if required)Converts SASL user ID (email) to current mapping style DN.searchUserEntry
(String id, Selection sel, CommonArgs ca) Searches user Entry for given SASL user ID (email) according to current mapping schema.userEntry2SaslId
(Entry uentry) Resolve SASL user ID for specific user entry using current mapping style
-
Constructor Details
-
SaslMapping
Creates a SaslMapping and tests/verifies current SASL mapping configuration and throws an exception on any problems- Parameters:
ds
- directory session (notnull
)sasl
- SASL configuration (notnull
)
-
-
Method Details
-
sasl2DN
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) (notnull
)baseDN
- base DN - fornull
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
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
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 configurationDSAPIException
-
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
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;
-