org.wamblee.glassfish.auth.cache.api
Interface AuthenticationCache

All Known Implementing Classes:
NoAuthenticationCache, SimpleExpiryCache

public interface AuthenticationCache

Interface for a cache of the authentication information.

Implementations should provide a public constructor with one argument of type Properties. The property object passed at construction contains the same properties that were passed to flexible JDBC realm. This allows users of a cache to configure a cache through the standard Glassfish security realm configuration.

Implementations should implement toString() to print a meaningful description of the cache for logging.

This interface is very similar to the AuthenticationRepository but is slightly different because it gets cached data and does not 'find' it. Also the contract differs in that it may return null and it has method for putting things into it.

Author:
Erik Brakkee

Method Summary
 java.util.List<java.lang.String> getGroups(java.lang.String aUsername)
          Gets the groups a user belongs to from the cache.
 java.lang.String getPassword(java.lang.String aUsername)
          Gets the cached password for a given user.
 java.lang.String getSeed(java.lang.String aUsername)
          Gets a cached seed for a given username based on the configured sql seed query.
 void setGroups(java.lang.String aUsername, java.util.List<java.lang.String> aGroups)
          Sets the groups for a given user.
 void setPassword(java.lang.String aUserName, java.lang.String aPassword)
          Sets the cached password for a user.
 void setSeed(java.lang.String aUsername, java.lang.String aSeed)
          Sets the seed.
 

Method Detail

getPassword

java.lang.String getPassword(java.lang.String aUsername)
Gets the cached password for a given user.

Parameters:
aUsername - Username.
Returns:
Password or null if no cached value is available.

setPassword

void setPassword(java.lang.String aUserName,
                 java.lang.String aPassword)
Sets the cached password for a user.

Parameters:
aUserName - Username.
aPassword - Password.

getGroups

java.util.List<java.lang.String> getGroups(java.lang.String aUsername)
Gets the groups a user belongs to from the cache.

Parameters:
aUsername - User.
Returns:
Groups. Returns a (possibly) empty list of cached groups or null of no cached groups are found.

setGroups

void setGroups(java.lang.String aUsername,
               java.util.List<java.lang.String> aGroups)
Sets the groups for a given user.

Parameters:
aUsername - User name.
aGroups - Groups (must be non-null).

getSeed

java.lang.String getSeed(java.lang.String aUsername)
Gets a cached seed for a given username based on the configured sql seed query.

Parameters:
aUsername - Username.
Returns:
The seed found or the empty string if no seeds or multiple seeds were found. Returns null in case no cached seed is available.

setSeed

void setSeed(java.lang.String aUsername,
             java.lang.String aSeed)
Sets the seed.

Parameters:
aUsername - Username.
aSeed - Seed (may not be null).


Copyright © 2019. All Rights Reserved.