org.acegisecurity.ldap
Class LdapUtils

java.lang.Object
  extended by org.acegisecurity.ldap.LdapUtils

public final class LdapUtils
extends Object

LDAP Utility methods.

Version:
$Id: LdapUtils.java 1784 2007-02-24 21:00:24Z luke_t $
Author:
Luke Taylor

Method Summary
static void closeContext(Context ctx)
           
static String getRelativeName(String fullDn, Context baseCtx)
          Obtains the part of a DN relative to a supplied base context.
static byte[] getUtf8Bytes(String s)
           
static String parseRootDnFromUrl(String url)
          Works out the root DN for an LDAP URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

closeContext

public static void closeContext(Context ctx)

getRelativeName

public static String getRelativeName(String fullDn,
                                     Context baseCtx)
                              throws NamingException
Obtains the part of a DN relative to a supplied base context.

If the DN is "cn=bob,ou=people,dc=acegisecurity,dc=org" and the base context name is "ou=people,dc=acegisecurity,dc=org" it would return "cn=bob".

Parameters:
fullDn - the DN
baseCtx - the context to work out the name relative to.
Returns:
the
Throws:
NamingException - any exceptions thrown by the context are propagated.

getUtf8Bytes

public static byte[] getUtf8Bytes(String s)

parseRootDnFromUrl

public static String parseRootDnFromUrl(String url)
Works out the root DN for an LDAP URL.

For example, the URL ldap://monkeymachine:11389/dc=acegisecurity,dc=org has the root DN "dc=acegisecurity,dc=org".

Parameters:
url - the LDAP URL
Returns:
the root DN


Copyright © 2004-2012 Interface21, Inc. All Rights Reserved.