org.mortbay.http

Class DigestAuthenticator

Implemented Interfaces:
Authenticator, Serializable
Known Direct 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)

Field Summary

protected long
maxNonceAge
protected long
nonceSecret
protected boolean
useStale

Method Summary

Principal
authenticate(UserRealm realm, String pathInContext, HttpRequest request, HttpResponse response)
int
checkNonce(String nonce, HttpRequest request)
String
getAuthMethod()
long
getMaxNonceAge()
long
getNonceSecret()
boolean
getUseStale()
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)

Field Details

maxNonceAge

protected long maxNonceAge

nonceSecret

protected long nonceSecret

useStale

protected boolean useStale

Method Details

authenticate

public Principal authenticate(UserRealm realm,
                              String pathInContext,
                              HttpRequest request,
                              HttpResponse response)
            throws IOException
Specified by:
authenticate in interface Authenticator
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.

checkNonce

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

getAuthMethod

public String getAuthMethod()
Specified by:
getAuthMethod in interface Authenticator

getMaxNonceAge

public long getMaxNonceAge()
Returns:
Returns the maxNonceAge.

getNonceSecret

public long getNonceSecret()
Returns:
Returns the nonceSecret.

getUseStale

public boolean getUseStale()

newNonce

public String newNonce(HttpRequest request)

sendChallenge

public void sendChallenge(UserRealm realm,
                          HttpRequest request,
                          HttpResponse response,
                          boolean stale)
            throws IOException

setMaxNonceAge

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

setNonceSecret

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

setUseStale

public void setUseStale(boolean us)

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