Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.securityfilter.authenticator
Class BasicAuthenticator  view BasicAuthenticator download BasicAuthenticator.java

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

public class BasicAuthenticator
extends java.lang.Object
implements Authenticator

BasicAuthenticator - authenticator implementation for the BASIC auth method.

Version:
$Revision: 1.2 $ $Date: 2003/07/14 18:55:14 $

Field Summary
protected  org.apache.commons.codec.binary.Base64 base64Helper
           
static java.lang.String LOGIN_ATTEMPTS
           
static java.lang.String LOGIN_FAILED_MESSAGE
           
static int MAX_ATTEMPTS
           
protected  org.securityfilter.realm.SecurityRealmInterface realm
           
protected  java.lang.String realmName
           
 
Constructor Summary
BasicAuthenticator()
           
 
Method Summary
 boolean bypassSecurityForThisRequest(org.securityfilter.filter.SecurityRequestWrapper request, org.securityfilter.filter.URLPatternMatcher patternMatcher)
          All requests should be subject to security checking for BASIC authentication.
private  java.lang.String decodeBasicAuthorizationString(java.lang.String authorization)
          Decode the BASIC authorization string.
 java.lang.String getAuthMethod()
          Returns BASIC as the authentication method.
 void init(javax.servlet.FilterConfig filterConfig, org.securityfilter.config.SecurityConfig securityConfig)
          Initialize this Authenticator.
private  java.lang.String parsePassword(java.lang.String decoded)
          Parse the password out of the decoded BASIC authorization header string.
private  java.lang.String parseUsername(java.lang.String decoded)
          Parse the username out of the BASIC authorization header string.
 boolean processLogin(org.securityfilter.filter.SecurityRequestWrapper 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 java.lang.String LOGIN_ATTEMPTS

LOGIN_FAILED_MESSAGE

public static final java.lang.String LOGIN_FAILED_MESSAGE
See Also:
Constant Field Values

MAX_ATTEMPTS

public static final int MAX_ATTEMPTS
See Also:
Constant Field Values

realm

protected org.securityfilter.realm.SecurityRealmInterface realm

realmName

protected java.lang.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,
                 org.securityfilter.config.SecurityConfig securityConfig)
          throws java.lang.Exception
Initialize this Authenticator.

Specified by:
init in interface Authenticator

getAuthMethod

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

Specified by:
getAuthMethod in interface Authenticator

processLogin

public boolean processLogin(org.securityfilter.filter.SecurityRequestWrapper request,
                            javax.servlet.http.HttpServletResponse response)
                     throws java.lang.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

bypassSecurityForThisRequest

public boolean bypassSecurityForThisRequest(org.securityfilter.filter.SecurityRequestWrapper request,
                                            org.securityfilter.filter.URLPatternMatcher patternMatcher)
All requests should be subject to security checking for BASIC authentication.

Specified by:
bypassSecurityForThisRequest in interface Authenticator

showLogin

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

Specified by:
showLogin in interface Authenticator

parseUsername

private java.lang.String parseUsername(java.lang.String decoded)
Parse the username out of the BASIC authorization header string.


parsePassword

private java.lang.String parsePassword(java.lang.String decoded)
Parse the password out of the decoded BASIC authorization header string.


decodeBasicAuthorizationString

private java.lang.String decodeBasicAuthorizationString(java.lang.String authorization)
Decode the BASIC authorization string.