org.apache.jetspeed.security.impl
Class AuthenticationProviderProxyImpl

java.lang.Object
  extended byorg.apache.jetspeed.security.impl.AuthenticationProviderProxyImpl
All Implemented Interfaces:
AuthenticationProviderProxy, CredentialHandler, UserSecurityHandler

public class AuthenticationProviderProxyImpl
extends Object
implements AuthenticationProviderProxy

Author:
David Le Strat
See Also:
AuthenticationProviderProxy

Field Summary
private  List authenticationProviders
          The list of AuthenticationProvider.
private  String defaultAuthenticationProvider
          The default authentication provider name.
 
Constructor Summary
AuthenticationProviderProxyImpl(List authenticationProviders, String defaultAuthenticationProvider)
           Constructor given a list of AuthenticationProvider.
 
Method Summary
 void addUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
           Adds a new user principal in the backing store.
 void addUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal, String authenticationProvider)
           Adds a new user principal in a given authentication provider.
 boolean authenticate(String userName, String password)
           Authenticate a user.
 boolean authenticate(String userName, String password, String authenticationProvider)
           Authenticate a user in a given authentication provider
 String getAuthenticationProvider(String userName)
           Returns the authentication provider of a user principal.
protected  AuthenticationProvider getAuthenticationProviderByName(String providerName)
           
 String getDefaultAuthenticationProvider()
           Returns the default authentication provider.
 Set getPrivateCredentials(String username)
           Gets the private credentials for the user.
 Set getPublicCredentials(String username)
           Gets the public credentials for the user.
 Principal getUserPrincipal(String username)
           Gets the user principal for the given user name.
 List getUserPrincipals(String filter)
           Gets the an iterator of user principals for a given filter.
 boolean isUserPrincipal(String userName)
           Checks if a UserPrincipal exists
 void removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
           Removes the user principal.
 void removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal, String authenticationProvider)
           Remove user principal in a given authentication provider.
 void setPassword(String userName, String oldPassword, String newPassword)
           Adds or updates a private password credential.
If oldPassword is not null, the oldPassword will first be checked (authenticated).
 void setPassword(String userName, String oldPassword, String newPassword, String authenticationProvider)
           Adds or updates a private password credential in a given authentication provider.
If oldPassword is not null, the oldPassword will first be checked (authenticated).
 void setPasswordEnabled(String userName, boolean enabled)
           Set the enabled state of the user password credential.
 void setPasswordEnabled(String userName, boolean enabled, String authenticationProvider)
           Set the enabled state of the user password credential in a given authentication provider.
 void setPasswordExpiration(String userName, Date expirationDate)
           Set the expiration date and the expired flag of the password credential.
 void setPasswordExpiration(String userName, Date expirationDate, String authenticationProvider)
           Set the expiration date and the expired flag of the password credential in a given authentication provider
 void setPasswordUpdateRequired(String userName, boolean updateRequired)
           Set the update required state of the user password credential.
 void setPasswordUpdateRequired(String userName, boolean updateRequired, String authenticationProvider)
           Set the update required state of the user password credential in a given authentication provider.
 void updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
           Updates the user principal in the backing store.
 void updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal, String authenticationProvider)
           Updates user principal in a given authentication provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authenticationProviders

private List authenticationProviders
The list of AuthenticationProvider.


defaultAuthenticationProvider

private String defaultAuthenticationProvider
The default authentication provider name.

Constructor Detail

AuthenticationProviderProxyImpl

public AuthenticationProviderProxyImpl(List authenticationProviders,
                                       String defaultAuthenticationProvider)

Constructor given a list of AuthenticationProvider.

Parameters:
authenticationProviders - The list of AuthenticationProvider.
defaultAuthenticationProvider - The default authentication provider name.
Method Detail

getAuthenticationProviderByName

protected AuthenticationProvider getAuthenticationProviderByName(String providerName)

getDefaultAuthenticationProvider

public String getDefaultAuthenticationProvider()
Description copied from interface: AuthenticationProviderProxy

Returns the default authentication provider.

Specified by:
getDefaultAuthenticationProvider in interface AuthenticationProviderProxy
Returns:
The default authentication provider.
See Also:
AuthenticationProviderProxy.getDefaultAuthenticationProvider()

getAuthenticationProvider

public String getAuthenticationProvider(String userName)
Description copied from interface: AuthenticationProviderProxy

Returns the authentication provider of a user principal.

Specified by:
getAuthenticationProvider in interface AuthenticationProviderProxy
Parameters:
userName -
Returns:
The authentication provider or null if user is unknown.
See Also:
AuthenticationProviderProxy.getAuthenticationProvider(java.lang.String)

isUserPrincipal

public boolean isUserPrincipal(String userName)
Description copied from interface: UserSecurityHandler

Checks if a UserPrincipal exists

Specified by:
isUserPrincipal in interface UserSecurityHandler
Parameters:
userName -
Returns:
true if a UserPrincipal exists
See Also:
UserSecurityHandler.isUserPrincipal(java.lang.String)

getUserPrincipal

public Principal getUserPrincipal(String username)
Description copied from interface: UserSecurityHandler

Gets the user principal for the given user name.

Specified by:
getUserPrincipal in interface UserSecurityHandler
Parameters:
username - The user name.
Returns:
The Principal

See Also:
UserSecurityHandler.getUserPrincipal(java.lang.String)

getUserPrincipals

public List getUserPrincipals(String filter)
Description copied from interface: UserSecurityHandler

Gets the an iterator of user principals for a given filter.

Specified by:
getUserPrincipals in interface UserSecurityHandler
Parameters:
filter - The filter.
Returns:
The list of Principal
See Also:
UserSecurityHandler.getUserPrincipals(java.lang.String)

addUserPrincipal

public void addUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal,
                             String authenticationProvider)
                      throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Adds a new user principal in a given authentication provider.

Specified by:
addUserPrincipal in interface AuthenticationProviderProxy
Parameters:
userPrincipal - The new user principal.
authenticationProvider - The authentication provider name.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.addUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

addUserPrincipal

public void addUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
                      throws org.apache.jetspeed.security.SecurityException
Description copied from interface: UserSecurityHandler

Adds a new user principal in the backing store.

Specified by:
addUserPrincipal in interface UserSecurityHandler
Parameters:
userPrincipal - The new UserPrincipal.
Throws:
org.apache.jetspeed.security.SecurityException - Throws a SecurityException.
See Also:
UserSecurityHandler.addUserPrincipal(org.apache.jetspeed.security.UserPrincipal)

updateUserPrincipal

public void updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal,
                                String authenticationProvider)
                         throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Updates user principal in a given authentication provider.

Specified by:
updateUserPrincipal in interface AuthenticationProviderProxy
Parameters:
userPrincipal - The user principal.
authenticationProvider - The authentication provider name.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

updateUserPrincipal

public void updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
                         throws org.apache.jetspeed.security.SecurityException
Description copied from interface: UserSecurityHandler

Updates the user principal in the backing store.

Specified by:
updateUserPrincipal in interface UserSecurityHandler
Parameters:
userPrincipal - The UserPrincipal.
Throws:
org.apache.jetspeed.security.SecurityException - Throws a SecurityException.
See Also:
UserSecurityHandler.updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal)

removeUserPrincipal

public void removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal,
                                String authenticationProvider)
                         throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Remove user principal in a given authentication provider.

Specified by:
removeUserPrincipal in interface AuthenticationProviderProxy
Parameters:
userPrincipal - The user principal.
authenticationProvider - The authentication provider name.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

removeUserPrincipal

public void removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal userPrincipal)
                         throws org.apache.jetspeed.security.SecurityException
Description copied from interface: UserSecurityHandler

Removes the user principal.

Specified by:
removeUserPrincipal in interface UserSecurityHandler
Parameters:
userPrincipal - The UserPrincipal.
Throws:
org.apache.jetspeed.security.SecurityException - Throws a SecurityException.
See Also:
UserSecurityHandler.removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal)

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)

setPassword

public void setPassword(String userName,
                        String oldPassword,
                        String newPassword,
                        String authenticationProvider)
                 throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

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

Specified by:
setPassword in interface AuthenticationProviderProxy
Parameters:
oldPassword - The old password value.
newPassword - The new password value.
authenticationProvider - The authentication provider name.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.setPassword(String, String, String, String)

setPassword

public void setPassword(String userName,
                        String oldPassword,
                        String newPassword)
                 throws org.apache.jetspeed.security.SecurityException
Description copied from interface: CredentialHandler

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:
oldPassword - The old password.
newPassword - The new password.
Throws:
org.apache.jetspeed.security.SecurityException - Throws a SecurityException.
See Also:
CredentialHandler.setPassword(java.lang.String,java.lang.String,java.lang.String)

getPrivateCredentials

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

Gets the private credentials for the user.

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

setPasswordEnabled

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

Set the enabled state of the user password credential in a given authentication provider.

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

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,
                                      String authenticationProvider)
                               throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Set the update required state of the user password credential in a given authentication provider.

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

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,
                                  String authenticationProvider)
                           throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Set the expiration date and the expired flag of the password credential in a given authentication provider

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 AuthenticationProviderProxy
Parameters:
userName - The user name.
expirationDate - The expiration date to set.
authenticationProvider - The authentication provider name.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.setPasswordExpiration(java.lang.String, java.sql.Date, java.lang.String)

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 userName,
                            String password,
                            String authenticationProvider)
                     throws org.apache.jetspeed.security.SecurityException
Description copied from interface: AuthenticationProviderProxy

Authenticate a user in a given authentication provider

Specified by:
authenticate in interface AuthenticationProviderProxy
Parameters:
userName - The user name.
password - The user password.
authenticationProvider - The authentication provider name.
Returns:
Whether or not a user is authenticated.
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
AuthenticationProviderProxy.authenticate(String, String, String)

authenticate

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

Authenticate a user.

Specified by:
authenticate in interface CredentialHandler
Parameters:
userName - 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)


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