org.apache.jetspeed.security.impl
Class AuthenticationProviderProxyImpl

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

public class AuthenticationProviderProxyImpl
extends java.lang.Object
implements AuthenticationProviderProxy

Author:
David Le Strat
See Also:
AuthenticationProviderProxy

Constructor Summary
AuthenticationProviderProxyImpl(java.util.List authenticationProviders, java.lang.String defaultAuthenticationProvider)
           Constructor given a list of AuthenticationProvider.
 
Method Summary
 void addUserPrincipal(UserPrincipal userPrincipal)
           Adds a new user principal in the backing store.
 void addUserPrincipal(UserPrincipal userPrincipal, java.lang.String authenticationProvider)
           Adds a new user principal in a given authentication provider.
 boolean authenticate(java.lang.String userName, java.lang.String password)
           Authenticate a user.
 boolean authenticate(java.lang.String userName, java.lang.String password, java.lang.String authenticationProvider)
           Authenticate a user in a given authentication provider
 java.lang.String getAuthenticationProvider(java.lang.String userName)
           Returns the authentication provider of a user principal.
protected  AuthenticationProvider getAuthenticationProviderByName(java.lang.String providerName)
           
 java.lang.String getDefaultAuthenticationProvider()
           Returns the default authentication provider.
 java.util.Set getPrivateCredentials(java.lang.String username)
           Gets the private credentials for the user.
 java.util.Set getPublicCredentials(java.lang.String username)
           Gets the public credentials for the user.
 java.security.Principal getUserPrincipal(java.lang.String username)
           Gets the user principal for the given user name.
 java.util.List getUserPrincipals(java.lang.String filter)
           Gets the an iterator of user principals for a given filter.
 void importPassword(java.lang.String userName, java.lang.String newPassword)
           Adds or updates a private password credentialin a given authentication provider.
Note that there is no checking of the oldPassword and the provided password is assumed to be encoded.
 void importPassword(java.lang.String userName, java.lang.String newPassword, java.lang.String authenticationProvider)
           Adds or updates a private password credentialin a given authentication provider.
Note that there is no checking of the oldPassword and the provided password is assumed to be encoded.
 boolean isUserPrincipal(java.lang.String userName)
           Checks if a UserPrincipal exists
 void removeUserPrincipal(UserPrincipal userPrincipal)
           Removes the user principal.
 void removeUserPrincipal(UserPrincipal userPrincipal, java.lang.String authenticationProvider)
           Remove user principal in a given authentication provider.
 void setPassword(java.lang.String userName, java.lang.String oldPassword, java.lang.String newPassword)
           Adds or updates a private password credential.
If oldPassword is not null, the oldPassword will first be checked (authenticated).
 void setPassword(java.lang.String userName, java.lang.String oldPassword, java.lang.String newPassword, java.lang.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(java.lang.String userName, boolean enabled)
           Set the enabled state of the user password credential.
 void setPasswordEnabled(java.lang.String userName, boolean enabled, java.lang.String authenticationProvider)
           Set the enabled state of the user password credential in a given authentication provider.
 void setPasswordExpiration(java.lang.String userName, java.sql.Date expirationDate)
           Set the expiration date and the expired flag of the password credential.
 void setPasswordExpiration(java.lang.String userName, java.sql.Date expirationDate, java.lang.String authenticationProvider)
           Set the expiration date and the expired flag of the password credential in a given authentication provider
 void setPasswordUpdateRequired(java.lang.String userName, boolean updateRequired)
           Set the update required state of the user password credential.
 void setPasswordUpdateRequired(java.lang.String userName, boolean updateRequired, java.lang.String authenticationProvider)
           Set the update required state of the user password credential in a given authentication provider.
 void updateUserPrincipal(UserPrincipal userPrincipal)
           Updates the user principal in the backing store.
 void updateUserPrincipal(UserPrincipal userPrincipal, java.lang.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
 

Constructor Detail

AuthenticationProviderProxyImpl

public AuthenticationProviderProxyImpl(java.util.List authenticationProviders,
                                       java.lang.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(java.lang.String providerName)

getDefaultAuthenticationProvider

public java.lang.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 java.lang.String getAuthenticationProvider(java.lang.String userName)
Description copied from interface: AuthenticationProviderProxy

Returns the authentication provider of a user principal.

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

isUserPrincipal

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

Checks if a UserPrincipal exists

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

getUserPrincipal

public java.security.Principal getUserPrincipal(java.lang.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 java.util.List getUserPrincipals(java.lang.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(UserPrincipal userPrincipal,
                             java.lang.String authenticationProvider)
                      throws 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:
SecurityException - Throws a security exception.
See Also:
AuthenticationProviderProxy.addUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

addUserPrincipal

public void addUserPrincipal(UserPrincipal userPrincipal)
                      throws 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:
SecurityException - Throws a SecurityException.
See Also:
UserSecurityHandler.addUserPrincipal(org.apache.jetspeed.security.UserPrincipal)

updateUserPrincipal

public void updateUserPrincipal(UserPrincipal userPrincipal,
                                java.lang.String authenticationProvider)
                         throws 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:
SecurityException - Throws a security exception.
See Also:
AuthenticationProviderProxy.updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

updateUserPrincipal

public void updateUserPrincipal(UserPrincipal userPrincipal)
                         throws 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:
SecurityException - Throws a SecurityException.
See Also:
UserSecurityHandler.updateUserPrincipal(org.apache.jetspeed.security.UserPrincipal)

removeUserPrincipal

public void removeUserPrincipal(UserPrincipal userPrincipal,
                                java.lang.String authenticationProvider)
                         throws 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:
SecurityException - Throws a security exception.
See Also:
AuthenticationProviderProxy.removeUserPrincipal(org.apache.jetspeed.security.UserPrincipal, java.lang.String)

removeUserPrincipal

public void removeUserPrincipal(UserPrincipal userPrincipal)
                         throws SecurityException
Description copied from interface: UserSecurityHandler

Removes the user principal.

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

getPublicCredentials

public java.util.Set getPublicCredentials(java.lang.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(java.lang.String userName,
                        java.lang.String oldPassword,
                        java.lang.String newPassword,
                        java.lang.String authenticationProvider)
                 throws 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:
userName - The name of the user to be updated.
oldPassword - The old password value.
newPassword - The new password value.
authenticationProvider - The authentication provider name.
Throws:
SecurityException - Throws a SecurityException.
See Also:
AuthenticationProviderProxy.setPassword(String, String, String, String)

setPassword

public void setPassword(java.lang.String userName,
                        java.lang.String oldPassword,
                        java.lang.String newPassword)
                 throws 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
oldPassword - The old password.
newPassword - The new password.
Throws:
SecurityException - Throws a SecurityException.
See Also:
CredentialHandler.setPassword(java.lang.String,java.lang.String,java.lang.String)

importPassword

public void importPassword(java.lang.String userName,
                           java.lang.String newPassword,
                           java.lang.String authenticationProvider)
                    throws SecurityException
Description copied from interface: AuthenticationProviderProxy

Adds or updates a private password credentialin a given authentication provider.
Note that there is no checking of the oldPassword and the provided password is assumed to be encoded. Hence no encoding will take place.

Specified by:
importPassword in interface AuthenticationProviderProxy
newPassword - The new password.
authenticationProvider - The authentication provider name.
Throws:
SecurityException - Throws a SecurityException.
See Also:
org.apache.jetspeed.security.AuthenticationProviderProxy#importPassword(String, String, String, String)

importPassword

public void importPassword(java.lang.String userName,
                           java.lang.String newPassword)
                    throws SecurityException
Description copied from interface: AuthenticationProviderProxy

Adds or updates a private password credentialin a given authentication provider.
Note that there is no checking of the oldPassword and the provided password is assumed to be encoded. Hence no encoding will take place.

Specified by:
importPassword in interface AuthenticationProviderProxy
Specified by:
importPassword in interface CredentialHandler
newPassword - The new password.
Throws:
SecurityException - Throws a SecurityException.
See Also:
org.apache.jetspeed.security.spi.CredentialHandler#importPassword(java.lang.String,java.lang.String,java.lang.String)

getPrivateCredentials

public java.util.Set getPrivateCredentials(java.lang.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(java.lang.String userName,
                               boolean enabled,
                               java.lang.String authenticationProvider)
                        throws 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:
SecurityException
See Also:
AuthenticationProviderProxy.setPasswordEnabled(java.lang.String, boolean, java.lang.String)

setPasswordEnabled

public void setPasswordEnabled(java.lang.String userName,
                               boolean enabled)
                        throws 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:
SecurityException
See Also:
CredentialHandler.setPasswordEnabled(java.lang.String, boolean)

setPasswordUpdateRequired

public void setPasswordUpdateRequired(java.lang.String userName,
                                      boolean updateRequired,
                                      java.lang.String authenticationProvider)
                               throws 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:
SecurityException
See Also:
AuthenticationProviderProxy.setPasswordUpdateRequired(java.lang.String, boolean, java.lang.String)

setPasswordUpdateRequired

public void setPasswordUpdateRequired(java.lang.String userName,
                                      boolean updateRequired)
                               throws 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:
SecurityException
See Also:
CredentialHandler.setPasswordUpdateRequired(java.lang.String, boolean)

setPasswordExpiration

public void setPasswordExpiration(java.lang.String userName,
                                  java.sql.Date expirationDate,
                                  java.lang.String authenticationProvider)
                           throws 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:
SecurityException
See Also:
AuthenticationProviderProxy.setPasswordExpiration(java.lang.String, java.sql.Date, java.lang.String)

setPasswordExpiration

public void setPasswordExpiration(java.lang.String userName,
                                  java.sql.Date expirationDate)
                           throws 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:
SecurityException
See Also:
CredentialHandler.setPasswordExpiration(java.lang.String, java.sql.Date)

authenticate

public boolean authenticate(java.lang.String userName,
                            java.lang.String password,
                            java.lang.String authenticationProvider)
                     throws 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:
SecurityException
See Also:
AuthenticationProviderProxy.authenticate(String, String, String)

authenticate

public boolean authenticate(java.lang.String userName,
                            java.lang.String password)
                     throws 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:
SecurityException
See Also:
CredentialHandler.authenticate(java.lang.String, java.lang.String)


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