EAF 7.6 Implementation

com.lutris.http
Class BasicAuth

java.lang.Object
  extended by com.lutris.http.BasicAuth

public class BasicAuth
extends java.lang.Object

Methods to be used to implement the HTTP Basic Auth authorization method. This is the standard username/password mechanism in use all over the web.

Note: the username and password are sent over the net base64 encoded, which is practically clear text. So this method is no more secure than the communication channel being used.

Usage:
When a request comes in, before responding to it, call getAuthentication(). It will return the username and password that was sent along with the request. If no authorization was sent, null is returned. The caller is then responsible for deciding if the username and password are valid.

If the caller decides that the authorization is not sufficient, a PageUnauthorizedException should be thrown.

If you are writing a LBS application, the recommended place to put this processing is in your Application's requestPreprocessor() function. That function is called for every request, before the presentation objects are called.

Version:
$Revision: 1.2 $
Author:
Andy John
See Also:
PageUnauthorizedException

Method Summary
static BasicAuthResult getAuthentication(com.lutris.appserver.server.httpPresentation.HttpPresentationRequest req)
          Checks to see if the authorization matches the given username and password.
static BasicAuthResult getAuthentication(javax.servlet.http.HttpServletRequest req)
          Extracts and returns the username and password using the HTTP Basic Auth method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAuthentication

public static BasicAuthResult getAuthentication(com.lutris.appserver.server.httpPresentation.HttpPresentationRequest req)
Checks to see if the authorization matches the given username and password. If not, or if no authorization was sent, false is returned. If req, username or password are null, then it is assumed that authentication is not being used, and all requests are allowed.

Parameters:
req - The request to authenticate.
Returns:
The username and password, or null if no authorization was sent.

getAuthentication

public static BasicAuthResult getAuthentication(javax.servlet.http.HttpServletRequest req)
Extracts and returns the username and password using the HTTP Basic Auth method. If no authorization was sent, null is returned. Use this flavor if you are writing a non-Enhydra servlet.

Parameters:
req - The request to authenticate.
Returns:
The username and password, or null if no authorization was sent.

EAF 7.6 Implementation