Author: elecharny Date: Sun Mar 11 03:03:37 2007 New Revision: 516878 URL: http://svn.apache.org/viewvc?view=rev&rev=516878 Log: Added the password into the class so that we can store it into the Authenticator cache. No need to create a new LdapPrincipal when an already stored principal exists. Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java?view=diff&rev=516878&r1=516877&r2=516878 ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java Sun Mar 11 03:03:37 2007 @@ -41,13 +41,16 @@ private static final long serialVersionUID = 3906650782395676720L; /** the normalized distinguished name of the principal */ - private final Name name; + private final LdapDN name; /** the no name anonymous user whose DN is the empty String */ public static final LdapPrincipal ANONYMOUS = new LdapPrincipal(); /** the authentication level for this principal */ private final AuthenticationLevel authenticationLevel; + + /** The userPassword */ + private byte[] userPassword; /** @@ -58,10 +61,27 @@ * @param name the normalized distinguished name of the principal * @param authenticationLevel */ - LdapPrincipal( Name name, AuthenticationLevel authenticationLevel ) + LdapPrincipal( LdapDN name, AuthenticationLevel authenticationLevel ) { this.name = name; this.authenticationLevel = authenticationLevel; + this.userPassword = null; + } + + /** + * Creates a new LDAP/X500 principal without any group associations. Keep + * this package friendly so only code in the package can create a + * trusted principal. + * + * @param name the normalized distinguished name of the principal + * @param authenticationLevel + * @param userPassword The user password + */ + LdapPrincipal( LdapDN name, AuthenticationLevel authenticationLevel, byte[] userPassword ) + { + this.name = name; + this.authenticationLevel = authenticationLevel; + this.userPassword = userPassword; } @@ -71,8 +91,9 @@ */ private LdapPrincipal() { - this.name = new LdapDN(); - this.authenticationLevel = AuthenticationLevel.NONE; + name = new LdapDN(); + authenticationLevel = AuthenticationLevel.NONE; + userPassword = null; } @@ -93,7 +114,7 @@ */ public String getName() { - return name.toString(); + return name.getNormName(); } @@ -115,5 +136,17 @@ public String toString() { return name.toString(); + } + + + public byte[] getUserPassword() + { + return userPassword; + } + + + public void setUserPassword( byte[] userPassword ) + { + this.userPassword = userPassword; } }