Class LoaderLdapElUtils
java.lang.Object
edu.internet2.middleware.grouper.app.loader.ldap.LoaderLdapElUtils
loaded in EL context for loader el's
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertAdMemberDnToSpecificValue
(String dn, String baseDn, String grouperBaseStem, boolean idOrIdentifier) convert a user dn to a user CN, and a group dn to a group ID or Uuidstatic String
convertDnToGroupName
(String dn, String baseDn, String grouperBaseStem) convert a DN to a group namestatic String
convert from uid=someapp,ou=people,dc=myschool,dc=edu to someappstatic String
convertDnToSpecificValueOrGroup
(String dn, String groupPrefix, String groupSuffix, boolean createGroupIfNotThere, boolean idOrIdentifier) convert from uid=someapp,ou=people,dc=myschool,dc=edu to someapp and allow groupsstatic String
convertDnToSpecificValueTest
(String dn, String subjectIdToReturnGroup, String groupToCreateReturn) test case showing a transformation where if the dn is the subjectIdToReturnGroup then make sure groupToCreateReturn exists and return its IDstatic String
convertDnToSubPath
(String dn, String baseDn, String searchDn) convert from uid=someapp,ou=people,dc=myschool,dc=edu baseDn is edu searchDn is myschool to people:someappstatic String
convertLDAPMemberDnToSubjectIdOrGroup
(String dn, String baseOu, String grouperBaseStem, String serverId, String uniqueAttribute, boolean idOrIdentifier) convert a subject dn to a user RDN value, and a group dn to a group ID or Uuidstatic String
ldapEscapeRdn
(String rdnString) This takes a string of attribute=value and makes sure that special, dn-relevant characters are escaped, particularly commas, pluses, etcstatic String
ldapEscapeRdnValue
(String rdnValue) This takes a string of value and makes sure that special, dn-relevant characters are escaped, particularly commas, pluses, etcstatic String
escape an ldap filter termstatic void
static String
take out accented chars e.g.
-
Constructor Details
-
LoaderLdapElUtils
public LoaderLdapElUtils()
-
-
Method Details
-
ldapEscapeRdn
This takes a string of attribute=value and makes sure that special, dn-relevant characters are escaped, particularly commas, pluses, etc- Parameters:
rdnString
- An RDN: attribute=value- Returns:
-
ldapEscapeRdnValue
This takes a string of value and makes sure that special, dn-relevant characters are escaped, particularly commas, pluses, etc- Parameters:
rdnString
- An RDN value: value- Returns:
- the escaped value
-
ldapFilterEscape
escape an ldap filter term- Parameters:
s
-- Returns:
- the filter
-
main
-
normalize
take out accented chars e.g. loaderLdapElUtils.normalize("NFD", groupAttribute).replaceAll("\\p{M}", "")- Parameters:
form
-text
-- Returns:
- normalized text
-
convertDnToSpecificValue
convert from uid=someapp,ou=people,dc=myschool,dc=edu to someapp- Parameters:
dn
-- Returns:
- the most specific value
-
convertDnToSpecificValueOrGroup
public static String convertDnToSpecificValueOrGroup(String dn, String groupPrefix, String groupSuffix, boolean createGroupIfNotThere, boolean idOrIdentifier) convert from uid=someapp,ou=people,dc=myschool,dc=edu to someapp and allow groups- Parameters:
dn
- full dngroupSuffix
- group suffix e.g. ,OU=Groups,DC=dev,DC=umontreal,DC=cagroupPrefix
- group prefix e.g. umontreal:adgroups: if null then no prefixcreateGroupIfNotThere
- if we should see if group exists and if not, createidOrIdentifier
- true for Id (uuid), false for Identifier of group (name)- Returns:
- the subjectId or Identifier
-
convertDnToSubPath
convert from uid=someapp,ou=people,dc=myschool,dc=edu baseDn is edu searchDn is myschool to people:someapp- Parameters:
dn
-baseDn
- if there is one, take it offsearchDn
- if there is one after the baseDn is off, take it off- Returns:
- the subpath
-
convertDnToSpecificValueTest
public static String convertDnToSpecificValueTest(String dn, String subjectIdToReturnGroup, String groupToCreateReturn) test case showing a transformation where if the dn is the subjectIdToReturnGroup then make sure groupToCreateReturn exists and return its ID- Parameters:
dn
-subjectIdToReturnGroup
-groupToCreateReturn
-- Returns:
- the subject id or group id
-
convertAdMemberDnToSpecificValue
public static String convertAdMemberDnToSpecificValue(String dn, String baseDn, String grouperBaseStem, boolean idOrIdentifier) convert a user dn to a user CN, and a group dn to a group ID or Uuid- Parameters:
baseDn
- e.g. OU=People,DC=devsim,DC=umontreal,DC=cadn
- of group membergrouperBaseStem
- is the base stem where the groups go. e.g. my:groups:idOrIdentifier
- true for id (group id), false for identifier (group name)- Returns:
- CN for person, Uuid or Group name for a group
-
convertDnToGroupName
convert a DN to a group name- Parameters:
dn
-baseDn
- e.g. OU=People,DC=devsim,DC=umontreal,DC=cagrouperBaseStem
- is the base stem where the groups go. e.g. my:groups:- Returns:
- the subject identifier (group name)
-
convertLDAPMemberDnToSubjectIdOrGroup
public static String convertLDAPMemberDnToSubjectIdOrGroup(String dn, String baseOu, String grouperBaseStem, String serverId, String uniqueAttribute, boolean idOrIdentifier) convert a subject dn to a user RDN value, and a group dn to a group ID or Uuid- Parameters:
dn
- of group member . Normally this will be as subjectIdbaseOu
- This is the full DN of the OU to load from LDAP e.g. OU=Some Example,DC=test,DC=school,DC=edugrouperBaseStem
- is the base stem where the groups are loaded into. e.g. my:groups:Loaded_from_LDAPserverId
- is the connection or server ID specified in grouper-loader.properties file. e.g: personLdapuniqueAttribute
- attribute value to return from LDAP query, preferably the one storing the subjectIdidOrIdentifier
- true for id (group id), false for identifier (group name)- Returns:
- RDN value for subject (user object), Uuid or Group name for a group
-