org.apache.jetspeed.security.spi
Interface InternalPasswordCredentialInterceptor


public interface InternalPasswordCredentialInterceptor

Callback component interface used by DefaultCredentialHandler allowing injecting custom logic on certain events of the InternalCredential.

Version:
$Id: InternalPasswordCredentialInterceptor.java 291016 2005-09-22 21:19:36Z ate $
Author:
Ate Douma

Method Summary
 boolean afterAuthenticated(InternalUserPrincipal internalUser, String userName, InternalCredential credential, boolean authenticated)
           Invoked during authentication after the provided password is compared against the one retrieved from the InternalCredential.
 boolean afterLoad(PasswordCredentialProvider pcProvider, String userName, InternalCredential credential)
           Invoked after a password credential is loaded from the persistent store.
 void beforeCreate(InternalUserPrincipal internalUser, Collection credentials, String userName, InternalCredential credential, String password)
           Invoked when the first password credential is to be saved for a user.
 void beforeSetPassword(InternalUserPrincipal internalUser, Collection credentials, String userName, InternalCredential credential, String password, boolean authenticated)
           Invoked when a new password value is to be saved for a user.
 

Method Detail

afterLoad

boolean afterLoad(PasswordCredentialProvider pcProvider,
                  String userName,
                  InternalCredential credential)
                  throws SecurityException

Invoked after a password credential is loaded from the persistent store.

If true is returned the credential is expected to be updated and its changes will be stored again.

A thrown SecurityException will be logged as an error and result in the credential to be ignored as if not existing (like for authentication).

Parameters:
pcProvider - provides callback access to for instance the configured CredentialPasswordEncoder and CredentialPasswordValidator
userName - the name of the principal to which the credential belongs
credential - the credential just loaded from the persistent store
Returns:
true if the credential is updated
Throws:
SecurityException
See Also:
org.apache.jetspeed.security.spi.impl.DefaultCredentialHandler#getPasswordCredential(InternalUserPrincipal, String), org.apache.jetspeed.security.spi.impl.DefaultCredentialHandler#setPasswordExpiration(String, java.sql.Date)

afterAuthenticated

boolean afterAuthenticated(InternalUserPrincipal internalUser,
                           String userName,
                           InternalCredential credential,
                           boolean authenticated)
                           throws SecurityException

Invoked during authentication after the provided password is compared against the one retrieved from the InternalCredential.

If true is returned, the credential is expected to be updated and its enabled and expired flags will checked if the credential is (still) valid.

Note: the enabled and expired flags are only checked if this method returns true.

A thrown SecurityException will be passed on to the authentication requestor.

Parameters:
internalUser - the user to which the credential belongs
userName - the name of the principal to which the credential belongs
credential - the credential of the user
authenticated - true if the provided password matches the value of the credential
Returns:
true if the credential is updated
Throws:
SecurityException
See Also:
org.apache.jetspeed.security.spi.impl.DefaultCredentialHandler#authenticate(String, String)

beforeCreate

void beforeCreate(InternalUserPrincipal internalUser,
                  Collection credentials,
                  String userName,
                  InternalCredential credential,
                  String password)
                  throws SecurityException

Invoked when the first password credential is to be saved for a user.

This callback method can be used to set default values like the expiration date.

A thrown SecurityException is passed on to the new password requestor.

Parameters:
internalUser - the user to which the credential belongs
credentials - the collection of credentials which will set on the user after (already contains the new credential)
userName - the name of the principal to which the credential belongs
credential - the credential of the user
password - the new password value (already set on the new credential)
Throws:
SecurityException
See Also:
org.apache.jetspeed.security.spi.impl.DefaultCredentialHandler#setPassword(String, String, String)

beforeSetPassword

void beforeSetPassword(InternalUserPrincipal internalUser,
                       Collection credentials,
                       String userName,
                       InternalCredential credential,
                       String password,
                       boolean authenticated)
                       throws SecurityException

Invoked when a new password value is to be saved for a user.

The new password value is not yet set on the provided credential when this callback is invoked. This allows custom history maintenance and/or auditing to be performed.

The provided authenticated flag can be used to differentiate between a new password value set directly by a user itself or through an administrative interface.

After this callback is invoked, the specified password value will be set, as well as a reset of the updateRequired flag, before the credential is saved.

A thrown SecurityException is passed on to the set password requestor.

Parameters:
internalUser - the user to which the credential belongs
credentials - the collection of credentials which will set on the user after (already contains the new credential)
userName - the name of the principal to which the credential belongs
credential - the credential of the user
password - the new password value (already set on the new credential)
authenticated - true if the new password value is provided by the user directly
Throws:
SecurityException
See Also:
org.apache.jetspeed.security.spi.impl.DefaultCredentialHandler#setPassword(String, String, String)


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