Top Description Inners Fields Constructors Methods
org.mortbay.jetty.security

public Class DigestAuthenticator

extends Object
implements Authenticator
Class Inheritance
All Implemented Interfaces
org.mortbay.jetty.Authenticator, java.io.Serializable
Imports
java.io.IOException, java.security.MessageDigest, .Principal, javax.servlet.http.HttpServletResponse, org.mortbay.jetty.Authenticator, .HttpHeaders, .Request, .Response, .UserRealm, org.mortbay.log.Log, org.mortbay.util.QuotedStringTokenizer, .StringUtil, .TypeUtil

DIGEST authentication.
Author
Greg Wilkins (gregw)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected long
protected long
protected boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Principal

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.
authenticate
(UserRealm
an UserRealm value
realm
,
String
a String value
pathInContext
,
Request
a Request value
request
,
Response
a Response value. If non-null response is passed, then a failed authentication will result in a challenge response being set in the response.
response
)

Implements org.mortbay.jetty.Authenticator.authenticate.

Authenticate.
public int

Returns:

-1 for a bad nonce, 0 for a stale none, 1 for a good nonce
checkNonce
(String nonce, Request request)

public String
public long

Returns:

Returns the maxNonceAge.
getMaxNonceAge
()

public long

Returns:

Returns the nonceSecret.
getNonceSecret
()

public boolean
public String
newNonce(Request request)

public void
sendChallenge(UserRealm realm, Request request, Response response, boolean stale)

public void
setMaxNonceAge(long
The maxNonceAge to set.
maxNonceAge
)

public void
setNonceSecret(long
The nonceSecret to set.
nonceSecret
)

public void
setUseStale(boolean us)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxNonceAgeback to summary
protected long maxNonceAge
nonceSecretback to summary
protected long nonceSecret
useStaleback to summary
protected boolean useStale

Constructor Detail

DigestAuthenticatorback to summary
public DigestAuthenticator()

Method Detail

authenticateback to summary
public Principal authenticate(UserRealm realm, String pathInContext, Request request, Response response) throws IOException

Implements org.mortbay.jetty.Authenticator.authenticate.

Doc from org.mortbay.jetty.Authenticator.authenticate.

Authenticate.

Parameters
realm:UserRealm

an UserRealm value

pathInContext:String

a String value

request:Request

a Request value

response:Response

a Response value. If non-null response is passed, then a failed authentication will result in a challenge response being set in the response.

Returns:Principal

UserPrinciple if authenticated or null if not. If Authentication fails, then the authenticator may have committed the response as an auth challenge or redirect.

Exceptions
IOException:
if an error occurs
checkNonceback to summary
public int checkNonce(String nonce, Request request)
Returns:int

-1 for a bad nonce, 0 for a stale none, 1 for a good nonce

getAuthMethodback to summary
public String getAuthMethod()

Implements org.mortbay.jetty.Authenticator.getAuthMethod.

getMaxNonceAgeback to summary
public long getMaxNonceAge()
Returns:long

Returns the maxNonceAge.

getNonceSecretback to summary
public long getNonceSecret()
Returns:long

Returns the nonceSecret.

getUseStaleback to summary
public boolean getUseStale()
newNonceback to summary
public String newNonce(Request request)
sendChallengeback to summary
public void sendChallenge(UserRealm realm, Request request, Response response, boolean stale) throws IOException
setMaxNonceAgeback to summary
public void setMaxNonceAge(long maxNonceAge)
Parameters
maxNonceAge:long

The maxNonceAge to set.

setNonceSecretback to summary
public void setNonceSecret(long nonceSecret)
Parameters
nonceSecret:long

The nonceSecret to set.

setUseStaleback to summary
public void setUseStale(boolean us)
org.mortbay.jetty.security back to summary

private Class DigestAuthenticator.Digest

extends Credential
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.
credentials
)

Implements abstract org.mortbay.jetty.security.Credential.check.

Check a credential
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.mortbay.jetty.security.Credential:
getCredential

Field Detail

cnonceback to summary
pack-priv String cnonce
methodback to summary
pack-priv String method
ncback to summary
pack-priv String nc
nonceback to summary
pack-priv String nonce
qopback to summary
pack-priv String qop
realmback to summary
pack-priv String realm
responseback to summary
pack-priv String response
uriback to summary
pack-priv String uri
usernameback to summary
pack-priv String username

Constructor Detail

Digestback to summary
pack-priv Digest(String m)

Method Detail

checkback to summary
public boolean check(Object credentials)

Implements abstract org.mortbay.jetty.security.Credential.check.

Doc from org.mortbay.jetty.security.Credential.check.

Check a credential

Parameters
credentials:Object

The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.

Returns:boolean

True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object