org.mortbay.http
Class DigestAuthenticator

java.lang.Object
  extended by org.mortbay.http.DigestAuthenticator
All Implemented Interfaces:
java.io.Serializable, Authenticator
Direct Known Subclasses:
DigestAuthenticator

public class DigestAuthenticator
extends java.lang.Object
implements Authenticator

DIGEST authentication.

Version:
$Id: DigestAuthenticator.java,v 1.16 2005/08/13 00:01:24 gregwilkins Exp $
Author:
Greg Wilkins (gregw)
See Also:
Serialized Form

Field Summary
protected  long maxNonceAge
           
protected  long nonceSecret
           
protected  boolean useStale
           
 
Constructor Summary
DigestAuthenticator()
           
 
Method Summary
 java.security.Principal authenticate(UserRealm realm, java.lang.String pathInContext, HttpRequest request, HttpResponse response)
          Authenticate.
 int checkNonce(java.lang.String nonce, HttpRequest request)
           
 java.lang.String getAuthMethod()
           
 long getMaxNonceAge()
           
 long getNonceSecret()
           
 boolean getUseStale()
           
 java.lang.String newNonce(HttpRequest request)
           
 void sendChallenge(UserRealm realm, HttpRequest request, HttpResponse response, boolean stale)
           
 void setMaxNonceAge(long maxNonceAge)
           
 void setNonceSecret(long nonceSecret)
           
 void setUseStale(boolean us)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxNonceAge

protected long maxNonceAge

nonceSecret

protected long nonceSecret

useStale

protected boolean useStale
Constructor Detail

DigestAuthenticator

public DigestAuthenticator()
Method Detail

authenticate

public java.security.Principal authenticate(UserRealm realm,
                                            java.lang.String pathInContext,
                                            HttpRequest request,
                                            HttpResponse response)
                                     throws java.io.IOException
Description copied from interface: Authenticator
Authenticate.

Specified by:
authenticate in interface Authenticator
Parameters:
realm - an UserRealm value
pathInContext - a String value
request - a HttpRequest value
response - a HttpResponse value. If non-null response is passed, then a failed authentication will result in a challenge response being set in the response.
Returns:
UserPrinciple if authenticated or null if not. If Authentication fails, then the authenticator may have committed the response as an auth challenge or redirect.
Throws:
java.io.IOException

getAuthMethod

public java.lang.String getAuthMethod()
Specified by:
getAuthMethod in interface Authenticator

sendChallenge

public void sendChallenge(UserRealm realm,
                          HttpRequest request,
                          HttpResponse response,
                          boolean stale)
                   throws java.io.IOException
Throws:
java.io.IOException

newNonce

public java.lang.String newNonce(HttpRequest request)

checkNonce

public int checkNonce(java.lang.String nonce,
                      HttpRequest request)
Parameters:
nonce -
request -
Returns:
-1 for a bad nonce, 0 for a stale none, 1 for a good nonce

getMaxNonceAge

public long getMaxNonceAge()
Returns:
Returns the maxNonceAge.

setMaxNonceAge

public void setMaxNonceAge(long maxNonceAge)
Parameters:
maxNonceAge - The maxNonceAge to set.

getNonceSecret

public long getNonceSecret()
Returns:
Returns the nonceSecret.

setNonceSecret

public void setNonceSecret(long nonceSecret)
Parameters:
nonceSecret - The nonceSecret to set.

setUseStale

public void setUseStale(boolean us)

getUseStale

public boolean getUseStale()


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.