public class EmailAddressDerivingLdapAttributeMapper extends SimpleLdapAttributeMapper implements EidDerivedEmailAddressHandler
| Constructor and Description |
|---|
EmailAddressDerivingLdapAttributeMapper() |
| Modifier and Type | Method and Description |
|---|---|
String |
deriveAddressFromEid(String rawEid)
Calculate an email address from the given user EID.
|
protected String |
doUnpackEidFromAddress(String address)
Calculates a user EID from an email address, assuming the address
has already passed muster with
validateAddress(String). |
String |
getAddressPattern()
Access the current email address validation pattern, as
assigned by
setAddressPattern(String). |
String |
getDefaultAddressDomain()
|
void |
mapLdapEntryOntoUserData(com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPEntry ldapEntry,
LdapUserData userData)
Performs
LDAPEntry-to- attribute
mappings. |
void |
setAddressPattern(String addressPattern)
Assign the
Pattern against which strings passed to
unpackEidFromAddress(String) must validate in order to
be processed by doUnpackEidFromAddress(String) |
void |
setDefaultAddressDomain(String domain)
Assign the domain to be used when deriving email addresses from
user EIDs.
|
String |
unpackEidFromAddress(String address)
Returns
doUnpackEidFromAddress(String) if the given
email/code> string validates against
|
protected boolean |
validateAddress(String address)
Validate the given string against the
Pattern configured
by setAddressPattern(String). |
escapeSearchFilterTerm, getAttributeMapping, getAttributeMappings, getFindUserByAidFilter, getFindUserByCrossAttributeSearchFilter, getFindUserByEidFilter, getFindUserByEmailFilter, getManyUsersInOneSearch, getReverseAttributeMap, getReverseAttributeMappings, getSearchResultAttributes, getUserBindDn, getUserDataDn, getUserTypeMapper, getValueMappings, init, mapLdapAttributeOntoUserData, mapLdapAttributeOntoUserData, mapLdapEntryToSakaiUserType, mapUserDataOntoUserEdit, reverseAttributeMap, setAttributeMappings, setUserDataDn, setUserTypeMapper, setValueMappings, usePreferredFirstNamepublic EmailAddressDerivingLdapAttributeMapper()
public String unpackEidFromAddress(String address) throws InvalidEmailAddressException
doUnpackEidFromAddress(String) if the given
email/code> string validates against
validateAddress(String). Otherwise throws a
. Throws the same
exception type if doUnpackEidFromAddress(String) returns
null or a whitespace string.unpackEidFromAddress in interface EidDerivedEmailAddressHandleraddress - and email address. Not necessarily guaranteed to be non-null or
even contain valid email syntaxemail argumentInvalidEmailAddressException - if email cannot be processed
for any reason. Implementation should raise this exception in any situation
where it might otherwise return nullprotected boolean validateAddress(String address)
Pattern configured
by setAddressPattern(String). A null pattern has
wildcard semantics.address - an email address to be validated against some pattern,
typically to verify that it belongs to an institutional domainprotected String doUnpackEidFromAddress(String address)
validateAddress(String).
This implementation strips all characters following the first
occurance of '@' and returns the remaining characters.address - a validated email addressnull or
whitespace strings.public void mapLdapEntryOntoUserData(com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPEntry ldapEntry,
LdapUserData userData)
SimpleLdapAttributeMapperLDAPEntry-to- attribute
mappings. Assigns the given LDAPEntry's DN to the
LdapUserData as a property keyed by
AttributeMappingConstants.USER_DN_PROPERTY. Then iterates
over LDAPEntry.getAttributeSet(), handing each attribute
to SimpleLdapAttributeMapper.mapLdapAttributeOntoUserData(LDAPAttribute, LdapUserData, Collection).
Then enforces the preferred first name field, if it exists.
Finally, assigns a "type" to the LdapUserData as defined
by SimpleLdapAttributeMapper.mapLdapEntryToSakaiUserType(LDAPEntry).mapLdapEntryOntoUserData in interface LdapAttributeMappermapLdapEntryOntoUserData in class SimpleLdapAttributeMapperldapEntry - the user's directory entryuserData - target LdapUserDataUserTypeMapperpublic String deriveAddressFromEid(String rawEid)
setDefaultAddressDomain(String). If that value is null,
or the inbound eid is null or whitespace, simply returns
nullstring - public String getAddressPattern()
setAddressPattern(String).Pattern. May return nullpublic void setAddressPattern(String addressPattern)
Pattern against which strings passed to
unpackEidFromAddress(String) must validate in order to
be processed by doUnpackEidFromAddress(String)addressPattern - a string to compile into a Pattern.
Compilation errors are raised immediately without modifications
to any already-assigned pattern. nulls accepted and
have wildcard semantics.public String getDefaultAddressDomain()
public void setDefaultAddressDomain(String domain)
setAddressPattern(String), so there could in fact be
many domains from which an EID could be unpacked, but only one
domain in which EID-derived email addresses will be created.
This behavior can technically be overridden in
deriveEmailFromEid(String).object - some email domain. Not validated. May be null.Copyright © 2005–2019 Sakai Project Contributor see (see NOTICE.txt). All rights reserved.