org.apache.jetspeed.security.spi.impl
Class LdapCredentialHandler

java.lang.Object
  extended byorg.apache.jetspeed.security.spi.impl.LdapCredentialHandler
All Implemented Interfaces:
CredentialHandler

public class LdapCredentialHandler
extends Object
implements CredentialHandler

Author:
Mike Long
See Also:
CredentialHandler

Field Summary
private  LdapUserCredentialDao ldap
          The LdapUserCredentialDao.
private static org.apache.commons.logging.Log LOG
          The logger.
 
Constructor Summary
LdapCredentialHandler()
           Default constructor.
LdapCredentialHandler(LdapUserCredentialDao ldap)
           Constructor given a LdapUserCredentialDao.
 
Method Summary
 boolean authenticate(String uid, String password)
           Authenticate a user.
 Set getPrivateCredentials(String uid)
           Gets the private credentials for the user.
 Set getPublicCredentials(String username)
           Gets the public credentials for the user.
private  void logSecurityException(org.apache.jetspeed.security.SecurityException e, String uid)
           
 void setPassword(String uid, String oldPassword, String newPassword)
           Adds or updates a private password credential.
 void setPasswordEnabled(String userName, boolean enabled)
           Set the enabled state of the user password credential.
 void setPasswordExpiration(String userName, Date expirationDate)
           Set the expiration date and the expired flag of the password credential.
 void setPasswordUpdateRequired(String userName, boolean updateRequired)
           Set the update required state of the user password credential.
private  void validate(String uid, String password)
           Validates the uid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG
The logger.


ldap

private LdapUserCredentialDao ldap
The LdapUserCredentialDao.

Constructor Detail

LdapCredentialHandler

public LdapCredentialHandler()
                      throws NamingException,
                             org.apache.jetspeed.security.SecurityException

Default constructor.


LdapCredentialHandler

public LdapCredentialHandler(LdapUserCredentialDao ldap)
                      throws NamingException,
                             org.apache.jetspeed.security.SecurityException

Constructor given a LdapUserCredentialDao.

Parameters:
ldap - The LdapUserCredentialDao.
Throws:
NamingException - A NamingException.
org.apache.jetspeed.security.SecurityException - A SecurityException.
Method Detail

getPublicCredentials

public Set getPublicCredentials(String username)
Description copied from interface: CredentialHandler

Gets the public credentials for the user.

Specified by:
getPublicCredentials in interface CredentialHandler
Parameters:
username - The username.
Returns:
The set of public credentials.
See Also:
CredentialHandler.getPublicCredentials(java.lang.String)

getPrivateCredentials

public Set getPrivateCredentials(String uid)
Description copied from interface: CredentialHandler

Gets the private credentials for the user.

Specified by:
getPrivateCredentials in interface CredentialHandler
Parameters:
uid - The username.
Returns:
The set of private credentials.
See Also:
CredentialHandler.getPrivateCredentials(java.lang.String)

logSecurityException

private void logSecurityException(org.apache.jetspeed.security.SecurityException e,
                                  String uid)

setPassword

public void setPassword(String uid,
                        String oldPassword,
                        String newPassword)
                 throws org.apache.jetspeed.security.SecurityException

Adds or updates a private password credential.
If oldPassword is not null, the oldPassword will first be checked (authenticated).

Specified by:
setPassword in interface CredentialHandler
Parameters:
uid - The LDAP uid attribute.
oldPassword - The old PasswordCredential.
newPassword - The new PasswordCredential.
Throws:
org.apache.jetspeed.security.SecurityException - when the lookup fails because the user does not exist or the non-null password is not correct. Throws a SecurityException.

setPasswordEnabled

public void setPasswordEnabled(String userName,
                               boolean enabled)
                        throws org.apache.jetspeed.security.SecurityException
Description copied from interface: CredentialHandler

Set the enabled state of the user password credential.

Specified by:
setPasswordEnabled in interface CredentialHandler
Parameters:
userName - The user name.
enabled - The enabled state.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
CredentialHandler.setPasswordEnabled(java.lang.String, boolean)

setPasswordUpdateRequired

public void setPasswordUpdateRequired(String userName,
                                      boolean updateRequired)
                               throws org.apache.jetspeed.security.SecurityException
Description copied from interface: CredentialHandler

Set the update required state of the user password credential.

Specified by:
setPasswordUpdateRequired in interface CredentialHandler
Parameters:
userName - The user name.
updateRequired - The update required state.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
CredentialHandler.setPasswordUpdateRequired(java.lang.String, boolean)

setPasswordExpiration

public void setPasswordExpiration(String userName,
                                  Date expirationDate)
                           throws org.apache.jetspeed.security.SecurityException
Description copied from interface: CredentialHandler

Set the expiration date and the expired flag of the password credential.

If a date equal or before the current date is provided, the expired flag will be set to true, otherwise to false.

Specified by:
setPasswordExpiration in interface CredentialHandler
Parameters:
userName - The user name.
expirationDate - The expiration date to set.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
CredentialHandler.setPasswordExpiration(java.lang.String, java.sql.Date)

authenticate

public boolean authenticate(String uid,
                            String password)
                     throws org.apache.jetspeed.security.SecurityException
Description copied from interface: CredentialHandler

Authenticate a user.

Specified by:
authenticate in interface CredentialHandler
Parameters:
uid - The user name.
password - The user password.
Returns:
Whether or not a user is authenticated.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
CredentialHandler.authenticate(java.lang.String, java.lang.String)

validate

private void validate(String uid,
                      String password)
               throws org.apache.jetspeed.security.SecurityException

Validates the uid.

Parameters:
uid - The uid.
password - The password.
Throws:
org.apache.jetspeed.security.SecurityException - Throws a SecurityException.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.