Class LdapUtils
java.lang.Object
org.springframework.security.ldap.LdapUtils
LDAP Utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeContext
(Context ctx) static void
static String
convertPasswordToString
(Object passObj) static org.springframework.ldap.core.DistinguishedName
Gets the full dn of a name by prepending the name of the context it is relative to.static String
getRelativeName
(String fullDn, Context baseCtx) Obtains the part of a DN relative to a supplied base context.static String
parseRootDnFromUrl
(String url) Works out the root DN for an LDAP URL.
-
Method Details
-
closeContext
-
closeEnumeration
-
getRelativeName
Obtains the part of a DN relative to a supplied base context.If the DN is "cn=bob,ou=people,dc=springframework,dc=org" and the base context name is "ou=people,dc=springframework,dc=org" it would return "cn=bob".
- Parameters:
fullDn
- the DNbaseCtx
- the context to work out the name relative to.- Returns:
- the
- Throws:
NamingException
- any exceptions thrown by the context are propagated.
-
getFullDn
public static org.springframework.ldap.core.DistinguishedName getFullDn(org.springframework.ldap.core.DistinguishedName dn, Context baseCtx) throws NamingException Gets the full dn of a name by prepending the name of the context it is relative to. If the name already contains the base name, it is returned unaltered.- Throws:
NamingException
-
convertPasswordToString
-
parseRootDnFromUrl
Works out the root DN for an LDAP URL.For example, the URL ldap://monkeymachine:11389/dc=springframework,dc=org has the root DN "dc=springframework,dc=org".
- Parameters:
url
- the LDAP URL- Returns:
- the root DN
-