public class DigestAuthenticator extends AuthenticatorBase
| Modifier and Type | Field and Description |
|---|---|
protected static String |
algorithm
The message digest algorithm to be used when generating session
identifiers.
|
protected int |
cnonceCacheSize
Maximum number of client nonces to keep in the cache.
|
protected static String |
DEFAULT_ALGORITHM
The default message digest algorithm to use if we cannot use
the requested one.
|
protected static DigestEncoder |
digestEncoder
The MD5 helper object for this class.
|
protected static String |
info
Descriptive information about this implementation.
|
protected String |
key
Private key.
|
protected static MessageDigest |
messageDigest
MD5 message digest provider.
|
protected long |
nonceValidity
How long server nonces are valid for in milliseconds.
|
protected String |
opaque
Opaque string.
|
protected static String |
QOP
DIGEST implementation only supports auth quality of protection.
|
protected boolean |
validateUri
Should the URI be validated as required by RFC2617? Can be disabled in
reverse proxies where the proxy has modified the URI.
|
alwaysUseSession, AUTH_HEADER_NAME, cache, changeSessionIdOnAuthentication, context, disableProxyCaching, entropy, log, random, randomClass, rb, REALM_NAME, securePagesWithPragma, SESSION_ID_BYTES, ssocontainer, controller, debug, domain, lifecycle, next, oname, startedAFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENTEND_PIPELINE, INVOKE_NEXT| Constructor and Description |
|---|
DigestAuthenticator() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
authenticate(HttpRequest request,
HttpResponse response,
LoginConfig config)
Authenticate the user making this request, based on the specified
login configuration.
|
protected static byte[] |
digest(byte[] data) |
protected String |
generateNonce(javax.servlet.http.HttpServletRequest request)
Generate a unique token.
|
static String |
getAlgorithm()
Return the message digest algorithm for this Manager.
|
protected String |
getAuthMethod() |
int |
getCnonceCacheSize() |
String |
getInfo()
Return descriptive information about this Valve implementation.
|
String |
getKey() |
protected static MessageDigest |
getMessageDigest() |
long |
getNonceValidity() |
String |
getOpaque() |
boolean |
isValidateUri() |
protected String |
parseUsername(String authorization)
Parse the username from the specified authorization string.
|
protected static String |
removeQuotes(String quotedString)
Removes the quotes on a string.
|
protected static String |
removeQuotes(String quotedString,
boolean quotesRequired)
Removes the quotes on a string.
|
static void |
setAlgorithm(String alg)
Set the message digest algorithm for this Manager.
|
protected void |
setAuthenticateHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
LoginConfig config,
String nOnce,
boolean isNonceStale)
Generates the WWW-Authenticate header.
|
void |
setCnonceCacheSize(int cnonceCacheSize) |
void |
setKey(String key) |
void |
setNonceValidity(long nonceValidity) |
void |
setOpaque(String opaque) |
void |
setValidateUri(boolean validateUri) |
void |
start()
Prepare for the beginning of active use of the public methods of this
component.
|
associate, doLogin, generateSessionId, getAlwaysUseSession, getCache, getContainer, getDebug, getDisableProxyCaching, getEntropy, getRandom, getRandomClass, getRealmName, getSession, getSession, getSingleSignOn, invoke, isChangeSessionIdOnAuthentication, isSecurePagesWithPragma, log, log, login, logout, postInvoke, register, setAlwaysUseSession, setCache, setChangeSessionIdOnAuthentication, setContainer, setDebug, setDisableProxyCaching, setEntropy, setRandomClass, setRealmName, setSecurePagesWithPragma, setSingleSignOn, stopaddLifecycleListener, backgroundProcess, createObjectName, event, findLifecycleListeners, getController, getDomain, getNext, getObjectName, getParentName, invoke, isStarted, removeLifecycleListener, setController, setNext, setObjectNameprotected static final DigestEncoder digestEncoder
protected static final String info
protected static final String QOP
protected static final String DEFAULT_ALGORITHM
protected static volatile String algorithm
java.security.MessageDigest class on your platform.protected static volatile MessageDigest messageDigest
protected int cnonceCacheSize
protected String key
protected long nonceValidity
protected String opaque
protected boolean validateUri
public static String getAlgorithm()
public static void setAlgorithm(String alg)
alg - The new message digest algorithmpublic String getInfo()
getInfo in interface ValvegetInfo in interface GlassFishValvegetInfo in class AuthenticatorBasepublic int getCnonceCacheSize()
public void setCnonceCacheSize(int cnonceCacheSize)
public String getKey()
public void setKey(String key)
public long getNonceValidity()
public void setNonceValidity(long nonceValidity)
public String getOpaque()
public void setOpaque(String opaque)
public boolean isValidateUri()
public void setValidateUri(boolean validateUri)
public boolean authenticate(HttpRequest request, HttpResponse response, LoginConfig config) throws IOException
true if any specified
constraint has been satisfied, or false if we have
created a response challenge already.authenticate in class AuthenticatorBaserequest - Request we are processingresponse - Response we are creatingconfig - Login configuration describing how authentication
should be performedIOException - if an input/output error occursprotected String parseUsername(String authorization)
nullauthorization - Authorization string to be parsedprotected String getAuthMethod()
getAuthMethod in class AuthenticatorBaseprotected static String removeQuotes(String quotedString, boolean quotesRequired)
protected static String removeQuotes(String quotedString)
protected String generateNonce(javax.servlet.http.HttpServletRequest request)
request - HTTP Servlet requestprotected void setAuthenticateHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
LoginConfig config,
String nOnce,
boolean isNonceStale)
The header MUST follow this template :
WWW-Authenticate = "WWW-Authenticate" ":" "Digest"
digest-challenge
digest-challenge = 1#( realm | [ domain ] | nOnce |
[ digest-opaque ] |[ stale ] | [ algorithm ] )
realm = "realm" "=" realm-value
realm-value = quoted-string
domain = "domain" "=" <"> 1#URI <">
nonce = "nonce" "=" nonce-value
nonce-value = quoted-string
opaque = "opaque" "=" quoted-string
stale = "stale" "=" ( "true" | "false" )
algorithm = "algorithm" "=" ( "MD5" | token )
request - HTTP Servlet requestresponse - HTTP Servlet responseconfig - Login configuration describing how authentication
should be performednOnce - nonce tokenprotected static MessageDigest getMessageDigest()
protected static byte[] digest(byte[] data)
public void start()
throws LifecycleException
AuthenticatorBaseconfigure(),
and before any of the public methods of the component are utilized.start in interface Lifecyclestart in class AuthenticatorBaseLifecycleException - if this component detects a fatal error
that prevents this component from being usedCopyright © 2017. All rights reserved.