public class ReadOnlyLDAPUser extends Object implements User, Serializable
ReadOnlyUsersLDAPRepository
or its subclasses. Consequently it does
not permit the mutation of user details. It is intended purely as an
encapsulation of the user information as held in the LDAP directory, and as a
means of authenticating the user against the LDAP server. Consequently
invocations of the contract method User.setPassword(String)
always
returns false
.SimpleLDAPConnection
,
ReadOnlyUsersLDAPRepository
,
Serialized FormConstructor and Description |
---|
ReadOnlyLDAPUser(String userName,
String userDN,
LdapContext ldapContext)
Constructs an instance for the given user-details, and which will
authenticate against the given host.
|
Modifier and Type | Method and Description |
---|---|
String |
getUserName()
Fulfils the contract
User.getUserName() . |
boolean |
setPassword(String newPass)
Implementation of contract
User.setPassword(String) , which is
provided for compliance purposes only. |
boolean |
verifyPassword(String password)
Verifies that the password supplied is actually the user's password, by
attempting to rebind to a copy of the LDAP server context using the user's
username and the supplied password.
|
public ReadOnlyLDAPUser(String userName, String userDN, LdapContext ldapContext) throws NamingException
userName
- The user-identifier/name. This is the value with which the
field #userName
will be initialised, and which will be
returned by invoking getUserName()
.userDN
- The distinguished (unique-key) of the user details as stored
on the LDAP directory.ldapContext
- The context for the LDAP server on which the user details are held.
This is also the host against which the user will be
authenticated, when verifyPassword(String)
is
invoked.NamingException
public String getUserName()
User.getUserName()
. It returns the value of
the field #userName
. This is generally the value from which the
user email address is built, by appending the domain name to it.getUserName
in interface User
public boolean setPassword(String newPass)
User.setPassword(String)
, which is
provided for compliance purposes only. Instances of this type mirror LDAP
data and do not perform any updates to the directory. Consequently, this
method always returns false
and does not do any work.setPassword
in interface User
newPass
- the String that is the new password.False
public boolean verifyPassword(String password)
verifyPassword
in interface User
password
- The password to validate.True
if a connection can successfully be established
to the LDAP host using the user's id and the supplied password,
and False
otherwise.Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.