Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.providers.dao.salt
Class ReflectionSaltSource  view ReflectionSaltSource download ReflectionSaltSource.java

java.lang.Object
  extended byorg.acegisecurity.providers.dao.salt.ReflectionSaltSource
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.acegisecurity.providers.dao.SaltSource

public class ReflectionSaltSource
extends java.lang.Object
implements org.acegisecurity.providers.dao.SaltSource, org.springframework.beans.factory.InitializingBean

Obtains a salt from a specified property of the User object.

This allows you to subclass User and provide an additional bean getter for a salt. You should use a synthetic value that does not change, such as a database primary key. Do not use username if it is likely to change.

Version:
$Id: ReflectionSaltSource.java,v 1.7 2005/11/29 13:10:12 benalex Exp $

Field Summary
private  java.lang.String userPropertyToUse
           
 
Constructor Summary
ReflectionSaltSource()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 java.lang.Object getSalt(org.acegisecurity.userdetails.UserDetails user)
          Performs reflection on the passed User to obtain the salt.
 java.lang.String getUserPropertyToUse()
           
 void setUserPropertyToUse(java.lang.String userPropertyToUse)
          The method name to call to obtain the salt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userPropertyToUse

private java.lang.String userPropertyToUse
Constructor Detail

ReflectionSaltSource

public ReflectionSaltSource()
Method Detail

getSalt

public java.lang.Object getSalt(org.acegisecurity.userdetails.UserDetails user)
Performs reflection on the passed User to obtain the salt.

The property identified by userPropertyToUse must be available from the passed User object. If it is not available, an org.acegisecurity.AuthenticationServiceException will be thrown.

Specified by:
getSalt in interface org.acegisecurity.providers.dao.SaltSource

setUserPropertyToUse

public void setUserPropertyToUse(java.lang.String userPropertyToUse)
The method name to call to obtain the salt. If your UserDetails contains a UserDetails.getSalt() method, you should set this property to getSalt.


getUserPropertyToUse

public java.lang.String getUserPropertyToUse()

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from interface: org.springframework.beans.factory.InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean