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

Quick Search    Search Deep

com.lutris.http
Class BasicAuth  view BasicAuth download BasicAuth.java

java.lang.Object
  extended bycom.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.10.14.1 $

Constructor Summary
private BasicAuth()
           
 
Method Summary
private static BasicAuthResult getAuth(java.lang.String authHeader)
           
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.
static BasicAuthResult getAuthentication(com.lutris.appserver.server.jolt.joltpo.JoltRequest req)
          Checks to see if the authorization matches the given username and password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAuth

private BasicAuth()
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.


getAuthentication

public static BasicAuthResult getAuthentication(com.lutris.appserver.server.jolt.joltpo.JoltRequest 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.


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.


getAuth

private static BasicAuthResult getAuth(java.lang.String authHeader)