public class DirectoryServicesImpl extends Object implements AMConstants, IDirectoryServices
Modifier and Type | Field and Description |
---|---|
protected CallBackHelper |
callBackHelper |
protected ComplianceServicesImpl |
complianceImpl |
protected DCTreeServicesImpl |
dcTreeImpl |
static Debug |
debug |
protected static String |
EXTERNAL_ATTRIBUTES_FETCH_ENABLED_ATTR |
protected SSOToken |
internalToken |
static boolean |
isUserPluginInitialized |
protected static String |
NSROLE_ATTR |
protected static String |
NSROLEDN_ATTR |
ADD_MEMBER, ADMIN_GROUPS_ENABLED_ATTR, ADMIN_ROLE_ATTR, ADMINISTRATION_SERVICE, CACHE_ENABLED_DISABLED_KEY, CACHE_MAX_SIZE_KEY, COMPLIANCE_SPECIAL_FILTER_ATTR, COMPLIANCE_USER_DELETION_ATTR, CONTAINER_DEFAULT_TEMPLATE_ROLE, CONTAINER_SUPPORTED_TYPES_ATTRIBUTE, DCT_ATTRIBUTE_LIST_ATTR, DCT_ENABLED_ATTR, DOMAIN_ADMINISTRATORS, DOMAIN_HELP_DESK_ADMINISTRATORS, EMAIL_ATTRIBUTE, FILTER_ATTR_NAME, INET_ADMIN_OBJECT_CLASS, INET_DOMAIN_STATUS_ATTR, INET_DOMAIN_STATUS_ATTRIBUTE, INVALID_USERID_CHARACTERS, OTHER_COSATTR_TYPE, POLICY_COSATTR_TYPE, POLICY_SUFFIX, PRE_POST_PROCESSING_MODULES_ATTR, REMOVE_ATTRIBUTE, REMOVE_MEMBER, REQUIRED_SERVICES_ATTR, ROLE_MANAGED_CONTAINER_DN_ATTRIBUTE, SCOPE_BASE, SCOPE_ONE, SCOPE_SUB, SERVICE_STATUS_ATTRIBUTE, STATIC_GROUP_DN_ATTRIBUTE, SUBSCRIBABLE_ATTRIBUTE, UNIQUE_ATTRIBUTE_LIST_ATTRIBUTE, UNIQUE_MEMBER_ATTRIBUTE, USER_CREATE_NOTIFICATION_LIST, USER_DELETE_NOTIFICATION_LIST, USER_ENCRYPTED_PASSWORD_ATTRIBUTE, USER_ENTRY_PROCESSING_IMPL, USER_MODIFY_NOTIFICATION_LIST, USER_PASSWORD_ATTRIBUTE, USER_SEARCH_RETURN_ATTR, USERID_PASSWORD_VALIDATION_CLASS
Constructor and Description |
---|
DirectoryServicesImpl()
Ideally this constructor should be private, since we are extending this
class, it needs to be public.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(SSOToken token,
AMObjectListener listener,
Map configMap)
Add a listener object that will receive notifications when entries are
changed.
|
void |
changePassword(SSOToken token,
String entryDN,
String attrName,
String oldPassword,
String newPassword)
Changes user password.
|
String |
createAMTemplate(SSOToken token,
String entryDN,
int objectType,
String serviceName,
Map attributes,
int priority)
Create an AMTemplate (COSTemplate)
|
void |
createEntry(SSOToken token,
String entryName,
int objectType,
String parentDN,
Map attributes)
Create an entry in the Directory
|
boolean |
doesEntryExists(SSOToken token,
String entryDN)
Checks if the entry exists in the directory.
|
String |
getAMTemplateDN(SSOToken token,
String entryDN,
int objectType,
String serviceName,
int type)
Get the AMTemplate DN (COSTemplateDN)
|
Map |
getAttributes(SSOToken token,
String entryDN,
boolean ignoreCompliance,
boolean byteValues,
int profileType)
Gets all attributes corresponding to the entryDN.
|
Map |
getAttributes(SSOToken token,
String entryDN,
int profileType)
Returns a Map with attribute-values requested from the directory.
|
Map |
getAttributes(SSOToken token,
String entryDN,
Set attrNames,
boolean ignoreCompliance,
boolean byteValues,
int profileType)
Returns a map of attribute-values for requested attributes.
|
Map |
getAttributes(SSOToken token,
String entryDN,
Set attrNames,
int profileType)
Returns a Map with attribute-values requested from the directory.
|
Map |
getAttributesByteValues(SSOToken token,
String entryDN,
int profileType)
Returns a map of attribute-values for binary attributes.
|
Map |
getAttributesByteValues(SSOToken token,
String entryDN,
Set attrNames,
int profileType)
Returns a map of attribute-values for binary attributes.
|
Set |
getAttributesForSchema(String objectclass)
Returns the set of attributes (both optional and required) needed for an
objectclass based on the LDAP schema
|
Map |
getAttributesFromDS(SSOToken token,
String entryDN,
Set attrNames,
boolean ignoreCompliance,
boolean byteValues,
int profileType)
Gets the specific attributes corresponding to the entryDN.
|
Map |
getAttributesFromDS(SSOToken token,
String entryDN,
Set attrNames,
int profileType)
Returns a Map with attribute-values fetched directly from the Directory.
|
IComplianceServices |
getComplianceServicesImpl()
Returns an implementation instance of IComplianceServices.
|
String |
getCreationTemplateName(int objectType)
Get the name of the creation template to use for specified object type.
|
Map |
getDCTreeAttributes(SSOToken token,
String entryDN,
Set attrNames,
boolean byteValues,
int objectType)
Gets the attributes for this entryDN from the corresponding DC Tree node.
|
IDCTreeServices |
getDCTreeServicesImpl()
Returns an implementation instance of IDCTreeServices.
|
protected String |
getEntryName(UMSException e) |
Map |
getExternalAttributes(SSOToken token,
String entryDN,
Set attrNames,
int profileType)
Returns attributes from an external data store.
|
String[] |
getGroupFilterAndScope(SSOToken token,
String entryDN,
int profileType)
Returns an array containing the dynamic group's scope, base dn, and
filter.
|
protected static IDirectoryServices |
getInstance() |
Set |
getMembers(SSOToken token,
String entryDN,
int objectType)
Get members for roles, dynamic group or static group
|
protected String |
getNamingAttribute(int objectType) |
String |
getNamingAttribute(int objectType,
String orgDN)
Gets the naming attribute after reading it from the corresponding
creation template.
|
String |
getObjectClass(int objectType)
Returns the objectclass representing an object type.
|
String |
getObjectClassFromDS(int objectType) |
int |
getObjectType(SSOToken token,
String dn)
Gets the type of the object given its DN.
|
int |
getObjectType(SSOToken token,
String dn,
Map cachedAttributes)
Gets the type of the object given its DN.
|
int |
getObjectType(String objectClass) |
String |
getOrganizationDN(SSOToken token,
String entryDN)
Gets the Organization DN for the specified entryDN.
|
String |
getOrgSearchFilter(String entryDN)
Returns the search filter for organization.
|
Set |
getRegisteredServiceNames(SSOToken token,
String entryDN)
Get registered services for an organization
|
String |
getSearchFilterFromTemplate(int objectType,
String orgDN,
String searchTemplateName)
Returns the search filter of a given search template.
|
Set |
getTopLevelContainers(SSOToken token)
Returns the set of top level containers that can be viewed by ths user
|
static AMUserEntryProcessed |
getUserPostPlugin()
Gets the user post plugin instance.
|
protected static boolean |
isExternalGetAttributesEnabled(String orgDN)
Method to check if the CallBack plugins are enabled for reading external
attributes.
|
void |
modifyMemberShip(SSOToken token,
Set members,
String target,
int type,
int operation)
Modify member ship for role or static group
|
void |
registerService(SSOToken token,
String orgDN,
String serviceName)
Register a service for an org or org unit policy to a profile
|
void |
removeAdminRole(SSOToken token,
String dn,
boolean recursive)
Remove group admin role
|
void |
removeEntry(SSOToken token,
String entryDN,
int objectType,
boolean recursive,
boolean softDelete)
Remove an entry from the directory.
|
String |
renameEntry(SSOToken token,
int objectType,
String entryDN,
String newName,
boolean deleteOldName)
Renames an entry.
|
Set |
search(SSOToken token,
String entryDN,
String searchFilter,
int searchScope)
Searches the Directory
|
AMSearchResults |
search(SSOToken token,
String entryDN,
String searchFilter,
SearchControl searchControl,
String[] attrNames)
Search the Directory
|
void |
setAttributes(SSOToken token,
String entryDN,
int objectType,
Map stringAttributes,
Map byteAttributes,
boolean isAdd)
Method Set the attributes of an entry.
|
void |
setGroupFilter(SSOToken token,
String entryDN,
String filter)
Sets the filter for a dynamic group in the datastore.
|
void |
unRegisterService(SSOToken token,
String entryDN,
int objectType,
String serviceName,
int type)
Un register service for a AMro profile.
|
void |
updateUserAttribute(SSOToken token,
Set members,
String staticGroupDN,
boolean toAdd)
Adds or remove static group DN to or from member attribute
'iplanet-am-static-group-dn'
|
String |
verifyAndGetOrgDN(SSOToken token,
String entryDN,
String childDN)
Gets the Organization DN for the specified entryDN.
|
protected static final String EXTERNAL_ATTRIBUTES_FETCH_ENABLED_ATTR
protected static String NSROLEDN_ATTR
protected static String NSROLE_ATTR
public static Debug debug
public static boolean isUserPluginInitialized
protected DCTreeServicesImpl dcTreeImpl
protected ComplianceServicesImpl complianceImpl
protected CallBackHelper callBackHelper
protected SSOToken internalToken
public DirectoryServicesImpl()
Use AMDirectoryWrapper.getInstance()
to create an
instance.
protected static IDirectoryServices getInstance()
protected String getEntryName(UMSException e)
protected static boolean isExternalGetAttributesEnabled(String orgDN)
public static AMUserEntryProcessed getUserPostPlugin()
public IDCTreeServices getDCTreeServicesImpl()
IDirectoryServices
getDCTreeServicesImpl
in interface IDirectoryServices
public IComplianceServices getComplianceServicesImpl()
IDirectoryServices
getComplianceServicesImpl
in interface IDirectoryServices
public boolean doesEntryExists(SSOToken token, String entryDN)
doesEntryExists
in interface IDirectoryServices
token
- a valid SSOTokenentryDN
- The DN of the entry that needs to be checkedpublic int getObjectType(SSOToken token, String dn) throws AMException, SSOException
getObjectType
in interface IDirectoryServices
token
- token a valid SSOTokendn
- DN of the object whose type is to be known.AMException
- if the data store is unavailable or if the object type is
unknownSSOException
- if ssoToken is invalid or expired.public int getObjectType(SSOToken token, String dn, Map cachedAttributes) throws AMException, SSOException
getObjectType
in interface IDirectoryServices
token
- token a valid SSOTokendn
- DN of the object whose type is to be known.cachedAttributes
- cached attributes of the userAMException
- if the data store is unavailable or if the object type is
unknownSSOException
- if ssoToken is invalid or expired.public Map getDCTreeAttributes(SSOToken token, String entryDN, Set attrNames, boolean byteValues, int objectType) throws AMException, SSOException
getDCTreeAttributes
in interface IDirectoryServices
token
- a valid SSOTokenentryDN
- the dn of the entryattrNames
- attribute namesbyteValues
- true
if result in byteobjectType
- the object type.AMException
- if error encountered in fetching the DC node attributes.SSOException
- If user's single sign on token is invalid.public Map getAttributes(SSOToken token, String entryDN, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributes
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributes(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributes
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.attrNames
- Set of attributes to be read.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributesFromDS(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributesFromDS
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.attrNames
- Set of attributes to be read.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributesByteValues(SSOToken token, String entryDN, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributesByteValues
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributesByteValues(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributesByteValues
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.attrNames
- Names of the attributes to be read.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributes(SSOToken token, String entryDN, boolean ignoreCompliance, boolean byteValues, int profileType) throws AMException, SSOException
getAttributes
in interface IDirectoryServices
token
- a valid SSOTokenentryDN
- the DN of the entry whose attributes need to retrievedignoreCompliance
- a boolean value specificying if compliance related entries
need to ignored or not. Ignored if true.byteValues
- Return binary attributes, if true.profileType
- Integer representing type of the object.AMException
- if an error is encountered in fetching the attributesSSOException
- If user's single sign on token is invalid.public Map getAttributes(SSOToken token, String entryDN, Set attrNames, boolean ignoreCompliance, boolean byteValues, int profileType) throws AMException, SSOException
IDirectoryServices
getAttributes
in interface IDirectoryServices
token
- User's single sign on tokenentryDN
- DN
of the entry.attrNames
- Set of attribute names to be read.ignoreCompliance
- Ignore compliance mode when constructing search filters.byteValues
- Return binary attributes, if true.profileType
- Integer representing type of the object.AMException
- If unable to access datastoreSSOException
- If user's single sign on token is invalid.public Map getAttributesFromDS(SSOToken token, String entryDN, Set attrNames, boolean ignoreCompliance, boolean byteValues, int profileType) throws AMException, SSOException
token
- a valid SSOTokenentryDN
- the DN of the entry whose attributes need to retrievedattrNames
- a Set of names of the attributes that need to be retrieved.
The attrNames should not be null.ignoreCompliance
- a boolean value specificying if compliance related entries
need to ignored or not. Ignored if true.AMException
- if an error is encountered in fetching the attributesSSOException
public String getOrgSearchFilter(String entryDN)
IDirectoryServices
getOrgSearchFilter
in interface IDirectoryServices
entryDN
- DN
of the organization.public String getOrganizationDN(SSOToken token, String entryDN) throws AMException
NOTE: This method will involve serveral directory searches, hence be cautious of Performance hit
getOrganizationDN
in interface IDirectoryServices
token
- a valid SSOTokenentryDN
- the entry whose parent Organization is to be obtainedAMException
- if an error occured while obtaining the parent Organizationpublic Map getExternalAttributes(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException
getExternalAttributes
in interface IDirectoryServices
token
- Single sign on token of userentryDN
- DN of the entry user is trying to readattrNames
- Set of attributes to be readprofileType
- Integer determining the type of profile being readAMException
- if an error occurs when trying to read external datastorepublic void updateUserAttribute(SSOToken token, Set members, String staticGroupDN, boolean toAdd) throws AMException
updateUserAttribute
in interface IDirectoryServices
token
- SSOTokenmembers
- set of user DN'sstaticGroupDN
- DN of the static grouptoAdd
- true to add, false to removeAMException
- if there is an internal problem with AM Store.public void createEntry(SSOToken token, String entryName, int objectType, String parentDN, Map attributes) throws AMEntryExistsException, AMException, SSOException
createEntry
in interface IDirectoryServices
token
- SSOTokenentryName
- name of the entry (naming value), e.g. "sun.com", "manager"objectType
- Profile Type, ORGANIZATION, AMObject.ROLE, AMObject.USER, etc.parentDN
- the parent DNattributes
- the initial attribute set for creationAMEntryExistsException
AMException
SSOException
public void removeEntry(SSOToken token, String entryDN, int objectType, boolean recursive, boolean softDelete) throws AMException, SSOException
removeEntry
in interface IDirectoryServices
token
- SSOTokenentryDN
- dn of the profile to be removedobjectType
- profile typerecursive
- if true, remove all sub entries & the objectsoftDelete
- Used to let pre/post callback plugins know that this delete is
either a soft delete (marked for deletion) or a purge/hard
delete itself, otherwise, remove the object onlyAMException
SSOException
public void removeAdminRole(SSOToken token, String dn, boolean recursive) throws SSOException, AMException
removeAdminRole
in interface IDirectoryServices
token
- SSOToken of the callerdn
- group DNrecursive
- true to delete all admin roles for all sub groups or sub
people containerSSOException
AMException
public Set search(SSOToken token, String entryDN, String searchFilter, int searchScope) throws AMException
search
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the entry to start the search withsearchFilter
- search filtersearchScope
- search scope, BASE, ONELEVEL or SUBTREEAMException
public AMSearchResults search(SSOToken token, String entryDN, String searchFilter, SearchControl searchControl, String[] attrNames) throws AMException
search
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the entry to start the search withsearchFilter
- search filtersearchControl
- search control defining the VLV indexes and search scopeattrNames
- name of attributesAMException
public Set getMembers(SSOToken token, String entryDN, int objectType) throws AMException
getMembers
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the role or groupobjectType
- objectType of the target object, AMObject.ROLE or
AMObject.GROUPAMException
public String renameEntry(SSOToken token, int objectType, String entryDN, String newName, boolean deleteOldName) throws AMException
renameEntry
in interface IDirectoryServices
token
- the sso tokenobjectType
- the type of entryentryDN
- the entry DNnewName
- the new name (i.e., if RDN is cn=John, the value passed should
be "John"deleteOldName
- if true the old name is deleted otherwise it is retained.DN
of the renamed entryAMException
- if the operation was not successfulpublic void setAttributes(SSOToken token, String entryDN, int objectType, Map stringAttributes, Map byteAttributes, boolean isAdd) throws AMException, SSOException
setAttributes
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the profile whose template is to be setobjectType
- profile typestringAttributes
- attributes to be setbyteAttributes
- attributes to be setisAdd
- true
if add to existing value;
otherwise replace the existing value.AMException
SSOException
public void changePassword(SSOToken token, String entryDN, String attrName, String oldPassword, String newPassword) throws AMException, SSOException
changePassword
in interface IDirectoryServices
token
- Single sign on tokenentryDN
- DN of the profile whose template is to be setattrName
- password attribute nameoldPassword
- old passwordnewPassword
- new passwordAMException
- if an error occurs when changing user passwordSSOException
- If user's single sign on token is invalid.public String[] getGroupFilterAndScope(SSOToken token, String entryDN, int profileType) throws SSOException, AMException
getGroupFilterAndScope
in interface IDirectoryServices
token
- Single sign on tokenentryDN
- DN of the profileSSOException
AMException
public void setGroupFilter(SSOToken token, String entryDN, String filter) throws AMException, SSOException
setGroupFilter
in interface IDirectoryServices
token
- entryDN
- filter
- AMException
SSOException
public void modifyMemberShip(SSOToken token, Set members, String target, int type, int operation) throws AMException
modifyMemberShip
in interface IDirectoryServices
token
- SSOTokenmembers
- Set of member DN to be operatedtarget
- DN of the target object to add the membertype
- type of the target object, AMObject.ROLE or AMObject.GROUPoperation
- type of operation, ADD_MEMBER or REMOVE_MEMBERAMException
public Set getRegisteredServiceNames(SSOToken token, String entryDN) throws AMException
getRegisteredServiceNames
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the orgAMException
public void registerService(SSOToken token, String orgDN, String serviceName) throws AMException, SSOException
registerService
in interface IDirectoryServices
token
- tokenorgDN
- DN of the orgserviceName
- Service NameAMException
SSOException
public void unRegisterService(SSOToken token, String entryDN, int objectType, String serviceName, int type) throws AMException
unRegisterService
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the profile whose service is to be removedobjectType
- profile typeserviceName
- Service Nametype
- Template typeAMException
public String getAMTemplateDN(SSOToken token, String entryDN, int objectType, String serviceName, int type) throws AMException
getAMTemplateDN
in interface IDirectoryServices
token
- SSOTokenentryDN
- DN of the profile whose template is to be setserviceName
- Service Nametype
- the template type, AMTemplate.DYNAMIC_TEMPLATEAMException
public String createAMTemplate(SSOToken token, String entryDN, int objectType, String serviceName, Map attributes, int priority) throws AMException
createAMTemplate
in interface IDirectoryServices
token
- tokenentryDN
- DN of the profile whose template is to be setobjectType
- the entry typeserviceName
- Service Nameattributes
- attributes to be setpriority
- template priorityAMException
protected String getNamingAttribute(int objectType)
public String getNamingAttribute(int objectType, String orgDN)
getNamingAttribute
in interface IDirectoryServices
objectType
- the type of object of interest.orgDN
- the organization dn the object belongs to.public String getCreationTemplateName(int objectType)
getCreationTemplateName
in interface IDirectoryServices
objectType
- Integere representing object typepublic String getObjectClassFromDS(int objectType)
public String getObjectClass(int objectType)
IDirectoryServices
getObjectClass
in interface IDirectoryServices
objectType
- the type of object of interest.public int getObjectType(String objectClass)
public String getSearchFilterFromTemplate(int objectType, String orgDN, String searchTemplateName)
IDirectoryServices
getSearchFilterFromTemplate
in interface IDirectoryServices
objectType
- Integere represenintg object type.orgDN
- Organization
searchTemplateName
- Name of search templatepublic Set getAttributesForSchema(String objectclass)
getAttributesForSchema
in interface IDirectoryServices
objectclass
- public Set getTopLevelContainers(SSOToken token) throws AMException, SSOException
IDirectoryServices
getTopLevelContainers
in interface IDirectoryServices
token
- User's single sign on token.AMException
- if a datastore access failsSSOException
- if user's single sign on token is invalid.public String verifyAndGetOrgDN(SSOToken token, String entryDN, String childDN) throws AMException
verifyAndGetOrgDN
in interface IDirectoryServices
token
- a valid SSOTokenentryDN
- the entry whose parent Organization is to be obtainedchildDN
- the immediate entry whose parent Organization is to be
obtainedAMException
- if an error occured while obtaining the parent Organizationpublic void addListener(SSOToken token, AMObjectListener listener, Map configMap) throws AMEventManagerException
IDirectoryServices
addListener
in interface IDirectoryServices
token
- SSOToken of the user adding the listnerlistener
- listener object that will be called when entries are changedAMEventManagerException
- if a error occurs during adding listener objectCopyright © 2010–2025 Open Identity Platform Community. All rights reserved.