org.securityfilter.authenticator
Class BasicAuthenticator

java.lang.Object
  extended byorg.securityfilter.authenticator.BasicAuthenticator
All Implemented Interfaces:
Authenticator

public class BasicAuthenticator
extends Object
implements Authenticator

BasicAuthenticator - authenticator implementation for the BASIC auth method.

Version:
$Revision: 1.5 $ $Date: 2004/07/24 08:34:39 $
Author:
Daya Sharma (iamdaya@yahoo.com, billydaya@sbcglobal.net), Max Cooper (max@maxcooper.com)

Field Summary
protected  org.apache.commons.codec.binary.Base64 base64Helper
           
static String LOGIN_ATTEMPTS
           
static String LOGIN_FAILED_MESSAGE
           
static int MAX_ATTEMPTS
           
protected  SecurityRealmInterface realm
           
protected  String realmName
           
 
Constructor Summary
BasicAuthenticator()
           
 
Method Summary
 boolean bypassSecurityForThisRequest(javax.servlet.http.HttpServletRequest request, URLPatternMatcher patternMatcher)
          All requests should be subject to security checking for BASIC authentication.
 String getAuthMethod()
          Returns BASIC as the authentication method.
 void init(javax.servlet.FilterConfig filterConfig, SecurityConfig securityConfig)
          Initialize this Authenticator.
 boolean processLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process any login information that was included in the request, if any.
 void showLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Show the login page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_ATTEMPTS

public static final String LOGIN_ATTEMPTS

LOGIN_FAILED_MESSAGE

public static final String LOGIN_FAILED_MESSAGE
See Also:
Constant Field Values

MAX_ATTEMPTS

public static final int MAX_ATTEMPTS
See Also:
Constant Field Values

realm

protected SecurityRealmInterface realm

realmName

protected String realmName

base64Helper

protected org.apache.commons.codec.binary.Base64 base64Helper
Constructor Detail

BasicAuthenticator

public BasicAuthenticator()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig,
                 SecurityConfig securityConfig)
          throws Exception
Initialize this Authenticator.

Specified by:
init in interface Authenticator
Parameters:
filterConfig -
securityConfig -
Throws:
Exception

getAuthMethod

public String getAuthMethod()
Returns BASIC as the authentication method.

Specified by:
getAuthMethod in interface Authenticator
Returns:
BASIC

processLogin

public boolean processLogin(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws Exception
Process any login information that was included in the request, if any. Returns true if SecurityFilter should abort further processing after the method completes (for example, if a redirect was sent as part of the login processing).

Specified by:
processLogin in interface Authenticator
Parameters:
request -
response -
Returns:
true if the filter should return after this method ends, false otherwise
Throws:
Exception

bypassSecurityForThisRequest

public boolean bypassSecurityForThisRequest(javax.servlet.http.HttpServletRequest request,
                                            URLPatternMatcher patternMatcher)
All requests should be subject to security checking for BASIC authentication.

Specified by:
bypassSecurityForThisRequest in interface Authenticator
Parameters:
request -
Returns:
always false -- check all requests

showLogin

public void showLogin(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws IOException
Show the login page.

Specified by:
showLogin in interface Authenticator
Parameters:
request - the current request
response - the current response
Throws:
IOException