Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

no.feide.moria
Class User  view User download User.java

java.lang.Object
  extended byno.feide.moria.User

public class User
extends java.lang.Object

Represents a user in the backend. Used to authenticate users and retrieve the associated attributes.


Field Summary
private static boolean initialized
          Used to show whether the system-wide JNDI init has been done.
private  javax.naming.ldap.InitialLdapContext ldap
          The LDAP context, initialized by authenticate(String, String).
private static java.lang.String ldapURL
          The URL to the (initial, if referrals) LDAP backend.
private static java.util.logging.Logger log
          Used for logging.
private  java.lang.String rdn
          Used to store the user element's relative DN.
private static java.lang.String usernameAttribute
          The name of the attribute used for username matching.
 
Constructor Summary
User()
           
 
Method Summary
 boolean authenticate(Credentials c)
          Initializes the connection to the backend, and authenticates the user using the supplied credentials.
 void close()
          Closes the connection to the LDAP server, as per javax.naming.InitialContext.close().
static User getInstance()
          Factory method.
private static void init()
          Used to do one-time global JNDI initialization, the very first time authenticate(Credentials) is called.
private  java.lang.String ldapSearch(java.lang.String pattern)
          Do a subtree search for an element given a pattern.
 java.util.HashMap lookup(java.lang.String[] attributes)
          Retrieves a list of attributes from a user element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log
Used for logging.


ldap

private javax.naming.ldap.InitialLdapContext ldap
The LDAP context, initialized by authenticate(String, String).


rdn

private java.lang.String rdn
Used to store the user element's relative DN.


initialized

private static boolean initialized
Used to show whether the system-wide JNDI init has been done.


usernameAttribute

private static java.lang.String usernameAttribute
The name of the attribute used for username matching.


ldapURL

private static java.lang.String ldapURL
The URL to the (initial, if referrals) LDAP backend.

Constructor Detail

User

public User()
Method Detail

getInstance

public static User getInstance()
                        throws BackendException
Factory method.


init

private static void init()
                  throws BackendException,
                         ConfigurationException
Used to do one-time global JNDI initialization, the very first time authenticate(Credentials) is called.


authenticate

public boolean authenticate(Credentials c)
                     throws BackendException
Initializes the connection to the backend, and authenticates the user using the supplied credentials.


ldapSearch

private java.lang.String ldapSearch(java.lang.String pattern)
                             throws BackendException
Do a subtree search for an element given a pattern. Only the first element found is considered. Any referrals are followed recursively.


lookup

public java.util.HashMap lookup(java.lang.String[] attributes)
                         throws BackendException
Retrieves a list of attributes from a user element.


close

public void close()
           throws BackendException
Closes the connection to the LDAP server, as per javax.naming.InitialContext.close().