Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.acegisecurity.providers.dao.salt
Class ReflectionSaltSource

    java.lang.Object
      org.acegisecurity.providers.dao.salt.ReflectionSaltSource

All Implemented Interfaces:
  SaltSource, InitializingBean

    public class ReflectionSaltSource

extends Object
implements SaltSource, 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 $
Author:
  Ben Alex

Constructor Summary
`ReflectionSaltSource()`

Method Summary
`void` | `afterPropertiesSet()`
`Object` | `getSalt(UserDetails user)` Performs reflection on the passed `User` to obtain the salt.
`String` | `getUserPropertyToUse()`
`void` | `setUserPropertyToUse(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`

Constructor Detail

### ReflectionSaltSource

    public ReflectionSaltSource()

Method Detail

### getSalt

    public Object getSalt(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 `AuthenticationServiceException` will be thrown.

  Specified by:
    `getSalt` in interface `SaltSource`
  Parameters:
    `user` - which contains the method identified by `userPropertyToUse`
  Returns:
    the result of invoking `user.userPropertyToUse()`
  Throws:
    `AuthenticationServiceException` - if reflection fails

### setUserPropertyToUse

    public void setUserPropertyToUse(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`.

  Parameters:
    `userPropertyToUse` - the name of the getter to call to obtain the salt from the `UserDetails`

### getUserPropertyToUse

    public String getUserPropertyToUse()

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2005 Acegi Technology Pty Limited. All Rights Reserved.