org.acegisecurity.ldap
Class LdapUtils

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

public class LdapUtils
extends Object

LDAP Utility methods.

Version:
$Id: LdapUtils.java 1496 2006-05-23 13:38:33Z benalex $
Author:
Luke Taylor

Constructor Summary
LdapUtils()
           
 
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
 

Constructor Detail

LdapUtils

public LdapUtils()
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-2006 Acegi Technology Pty Limited. All Rights Reserved.