1 package org.codehaus.plexus.redback.http.authentication;
5 import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
6 import org.codehaus.plexus.redback.authentication.AuthenticationException;
7 import org.codehaus.plexus.redback.authentication.AuthenticationResult;
8 import org.codehaus.plexus.redback.policy.AccountLockedException;
9 import org.codehaus.plexus.redback.policy.MustChangePasswordException;
10 import org.codehaus.plexus.redback.system.SecuritySession;
11 import org.codehaus.plexus.redback.users.User;
14 * An HttpAuthenticator using a Map for session storage
16 * @author Andrew Williams
20 public abstract class MapBasedHttpAuthenticator
21 extends AbstractHttpAuthenticator
24 protected Object getSessionValue( Object session, String key )
26 if ( !( session instanceof Map ) )
28 throw new IllegalArgumentException( "The session for a MapBasedAuthenticator must be a java.util.Map" );
31 return ( (Map) session ).get( key );
34 protected void setSessionValue( Object session, String key, Object value )
36 if ( !( session instanceof Map ) )
38 throw new IllegalArgumentException( "The session for a MapBasedAuthenticator must be a java.util.Map" );
41 ( (Map) session ).put( key, value );
44 public AuthenticationResult authenticate( AuthenticationDataSource ds, Map session )
45 throws AuthenticationException, AccountLockedException, MustChangePasswordException
47 return super.authenticate( ds, session );
50 public User getSessionUser( Map session )
52 return super.getSessionUser( session );
55 public boolean isAlreadyAuthenticated( Map session )
57 return super.isAlreadyAuthenticated( session );
60 public SecuritySession getSecuritySession( Map session )
62 return super.getSecuritySession( session );
65 public void setSecuritySession( SecuritySession session, Map sessionObj )
67 super.setSecuritySession( session, sessionObj );
70 public void setSessionUser( User user, Map session )
72 super.setSessionUser( user, session );
75 public String storeDefaultUser( String principal, Map session )
77 return super.storeDefaultUser( principal, session );