org.outerj.daisy.authentication.spi
Class CachingAuthenticationScheme
java.lang.Object
org.outerj.daisy.authentication.spi.CachingAuthenticationScheme
- All Implemented Interfaces:
- AuthenticationScheme
public class CachingAuthenticationScheme
- extends Object
- implements AuthenticationScheme
A wrapper around an AuthenticationScheme that performs credential caching.
CachingAuthenticationScheme
public CachingAuthenticationScheme(AuthenticationScheme delegate,
long maxCacheDuration,
int maxCacheSize)
- Parameters:
maxCacheDuration - max time an entry can stay in the cache before becoming invalid, in millismaxCacheSize - maximum size of the cache (should be large enough to handle max expected concurrent users
for optimal performance)
getDescription
public String getDescription()
- Specified by:
getDescription in interface AuthenticationScheme
clearCaches
public void clearCaches()
- Description copied from interface:
AuthenticationScheme
- Clear caches maintained by this authentication scheme, if any.
- Specified by:
clearCaches in interface AuthenticationScheme
check
public boolean check(Credentials credentials)
throws AuthenticationException
- Specified by:
check in interface AuthenticationScheme
- Returns:
- true if authentication successful, false otherwise
- Throws:
AuthenticationException - if an error occured while authenticating
createUser
public User createUser(Credentials crendentials,
UserManager userManager)
throws AuthenticationException
- Description copied from interface:
AuthenticationScheme
- If a user does not exist, the authentication scheme can be offered the
possibility to create the user (this is defined in the configuration of the
UserAuthenticator). It is up to the implementation of this method to
check the credentials are ok.
- Specified by:
createUser in interface AuthenticationScheme
- Throws:
AuthenticationException