public class DigestAuthenticator extends AuthenticatorBase
| Modifier and Type | Class and Description |
|---|---|
static class |
DigestAuthenticator.AuthDigest
This enum exists because RFC 7616 and Java use different names for some digests.
|
static class |
DigestAuthenticator.DigestInfo |
static class |
DigestAuthenticator.NonceInfo |
AuthenticatorBase.AllowCorsPreflightLifecycle.SingleUse| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
key
Private key.
|
protected long |
lastTimestamp
The last timestamp used to generate a nonce.
|
protected java.lang.Object |
lastTimestampLock |
protected int |
nonceCacheSize
Maximum number of server nonces to keep in the cache.
|
protected int |
nonceCountWindowSize
The window size to use to track seen nonce count values for a given nonce.
|
protected java.util.Map<java.lang.String,DigestAuthenticator.NonceInfo> |
nonces
List of server nonce values currently being tracked
|
protected long |
nonceValidity
How long server nonces are valid for in milliseconds.
|
protected java.lang.String |
opaque
Opaque string.
|
protected static java.lang.String |
QOP
Tomcat's DIGEST implementation only supports auth quality of protection.
|
protected boolean |
validateUri
Should the URI be validated as required by RFC2617?
|
alwaysUseSession, AUTH_HEADER_NAME, cache, changeSessionIdOnAuthentication, context, disableProxyCaching, jaspicCallbackHandlerClass, REALM_NAME, securePagesWithPragma, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sendAuthInfoResponseHeaders, sessionIdGenerator, sm, ssoasyncSupported, container, containerLog, nextmserverAFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT| Constructor and Description |
|---|
DigestAuthenticator() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doAuthenticate(Request request,
HttpServletResponse response)
Authenticate the user making this request, based on the specified login configuration.
|
protected java.lang.String |
generateNonce(Request request)
Generate a unique token.
|
java.lang.String |
getAlgorithms() |
protected java.lang.String |
getAuthMethod()
Return the authentication method, which is vendor-specific and not defined by HttpServletRequest.
|
java.lang.String |
getKey() |
int |
getNonceCacheSize() |
int |
getNonceCountWindowSize() |
long |
getNonceValidity() |
java.lang.String |
getOpaque() |
protected boolean |
isPreemptiveAuthPossible(Request request)
Can the authenticator perform preemptive authentication for the given request?
|
boolean |
isValidateUri() |
protected static java.lang.String |
removeQuotes(java.lang.String quotedString)
Removes the quotes on a string.
|
protected static java.lang.String |
removeQuotes(java.lang.String quotedString,
boolean quotesRequired)
Removes the quotes on a string.
|
void |
setAlgorithms(java.lang.String algorithmsString) |
protected void |
setAuthenticateHeader(HttpServletRequest request,
HttpServletResponse response,
java.lang.String nonce,
boolean isNonceStale)
Generates the WWW-Authenticate header(s) as per RFC 7616.
|
void |
setKey(java.lang.String key) |
void |
setNonceCacheSize(int nonceCacheSize) |
void |
setNonceCountWindowSize(int nonceCountWindowSize) |
void |
setNonceValidity(long nonceValidity) |
void |
setOpaque(java.lang.String opaque) |
void |
setValidateUri(boolean validateUri) |
protected void |
startInternal()
Start this component and implement the requirements of
LifecycleBase.startInternal(). |
allowCorsPreflightBypass, associate, authenticate, changeSessionID, checkForCachedAuthentication, doLogin, getAllowCorsPreflight, getAlwaysUseSession, getCache, getChangeSessionIdOnAuthentication, getContainer, getDisableProxyCaching, getJaspicCallbackHandlerClass, getRealmName, getSecurePagesWithPragma, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, invoke, isContinuationRequired, isSendAuthInfoResponseHeaders, login, logout, notify, reauthenticateFromSSO, register, register, setAllowCorsPreflight, setAlwaysUseSession, setCache, setChangeSessionIdOnAuthentication, setContainer, setDisableProxyCaching, setJaspicCallbackHandlerClass, setSecurePagesWithPragma, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSendAuthInfoResponseHeaders, stopInternalbackgroundProcess, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setNext, toStringdestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisteraddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopprotected static final java.lang.String QOP
protected java.util.Map<java.lang.String,DigestAuthenticator.NonceInfo> nonces
protected long lastTimestamp
protected final java.lang.Object lastTimestampLock
protected int nonceCacheSize
protected int nonceCountWindowSize
protected java.lang.String key
protected long nonceValidity
protected java.lang.String opaque
protected boolean validateUri
public int getNonceCountWindowSize()
public void setNonceCountWindowSize(int nonceCountWindowSize)
public int getNonceCacheSize()
public void setNonceCacheSize(int nonceCacheSize)
public java.lang.String getKey()
public void setKey(java.lang.String key)
public long getNonceValidity()
public void setNonceValidity(long nonceValidity)
public java.lang.String getOpaque()
public void setOpaque(java.lang.String opaque)
public boolean isValidateUri()
public void setValidateUri(boolean validateUri)
public java.lang.String getAlgorithms()
public void setAlgorithms(java.lang.String algorithmsString)
protected boolean doAuthenticate(Request request, HttpServletResponse response) throws java.io.IOException
true
if any specified constraint has been satisfied, or false if we have created a response challenge
already.doAuthenticate in class AuthenticatorBaserequest - Request we are processingresponse - Response we are creatingtrue if the the user was authenticated, otherwise false, in which case an authentication challenge will have been written to the responsejava.io.IOException - if an input/output error occursprotected java.lang.String getAuthMethod()
AuthenticatorBasegetAuthMethod in class AuthenticatorBaseprotected static java.lang.String removeQuotes(java.lang.String quotedString,
boolean quotesRequired)
quotedString - The quoted stringquotesRequired - true if quotes were requiredprotected static java.lang.String removeQuotes(java.lang.String quotedString)
quotedString - The quoted stringprotected java.lang.String generateNonce(Request request)
request - HTTP Servlet requestprotected void setAuthenticateHeader(HttpServletRequest request, HttpServletResponse response, java.lang.String nonce, boolean isNonceStale)
request - HTTP Servlet requestresponse - HTTP Servlet responsenonce - nonce tokenisNonceStale - true to add a stale parameterprotected boolean isPreemptiveAuthPossible(Request request)
AuthenticatorBaseisPreemptiveAuthPossible in class AuthenticatorBaserequest - The request to check for credentialstrue if preemptive authentication is possible, otherwise falseprotected void startInternal()
throws LifecycleException
ValveBaseLifecycleBase.startInternal().startInternal in class AuthenticatorBaseLifecycleException - if this component detects a fatal error that prevents this component from being
usedCopyright © 2000-2024 Apache Software Foundation.
Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo are either registered trademarks or trademarks of the Apache Software Foundation.