Package org.restlet.ext.crypto.internal
Class HttpDigestVerifier
- java.lang.Object
-
- org.restlet.security.SecretVerifier
-
- org.restlet.ext.crypto.DigestVerifier<LocalVerifier>
-
- org.restlet.ext.crypto.internal.HttpDigestVerifier
-
- All Implemented Interfaces:
Verifier
public class HttpDigestVerifier extends DigestVerifier<LocalVerifier>
Verifier for the HTTP DIGEST authentication scheme. Note that the "A1" hash specified in RFC 2617 is available via theDigestVerifier.getWrappedSecretDigest(String)method.
-
-
Field Summary
Fields Modifier and Type Field Description private DigestAuthenticatordigestAuthenticatorThe associated digest authenticator.-
Fields inherited from interface org.restlet.security.Verifier
RESULT_INVALID, RESULT_MISSING, RESULT_STALE, RESULT_UNKNOWN, RESULT_UNSUPPORTED, RESULT_VALID
-
-
Constructor Summary
Constructors Constructor Description HttpDigestVerifier(DigestAuthenticator digestAuthenticator, LocalVerifier wrappedVerifier, java.lang.String wrappedAlgorithm)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected char[]digest(java.lang.String identifier, char[] secret, java.lang.String algorithm)If the algorithm isDigest.ALGORITHM_HTTP_DIGEST, then is retrieves the realm forgetDigestAuthenticator()to compute the digest, otherwise, it keeps the default behavior.DigestAuthenticatorgetDigestAuthenticator()Returns the associated digest authenticator.voidsetDigestAuthenticator(DigestAuthenticator digestAuthenticator)Sets the associated digest authenticator.intverify(Request request, Response response)Verifies that the proposed secret is correct for the specified request.-
Methods inherited from class org.restlet.ext.crypto.DigestVerifier
getAlgorithm, getWrappedAlgorithm, getWrappedSecret, getWrappedSecretDigest, getWrappedVerifier, setAlgorithm, setWrappedAlgorithm, setWrappedVerifier, verify
-
Methods inherited from class org.restlet.security.SecretVerifier
compare, createUser, getIdentifier, getSecret
-
-
-
-
Field Detail
-
digestAuthenticator
private DigestAuthenticator digestAuthenticator
The associated digest authenticator.
-
-
Constructor Detail
-
HttpDigestVerifier
public HttpDigestVerifier(DigestAuthenticator digestAuthenticator, LocalVerifier wrappedVerifier, java.lang.String wrappedAlgorithm)
Constructor.- Parameters:
digestAuthenticator- The associated digest authenticator.wrappedAlgorithm- The digest algorithm of secrets provided by the wrapped verifier.wrappedVerifier- The wrapped secret verifier.
-
-
Method Detail
-
digest
protected char[] digest(java.lang.String identifier, char[] secret, java.lang.String algorithm)If the algorithm isDigest.ALGORITHM_HTTP_DIGEST, then is retrieves the realm forgetDigestAuthenticator()to compute the digest, otherwise, it keeps the default behavior.- Overrides:
digestin classDigestVerifier<LocalVerifier>- Parameters:
identifier- The user identifier.secret- The regular secret to digest.algorithm- The digest algorithm to use.- Returns:
- The digested secret.
- See Also:
Digest
-
getDigestAuthenticator
public DigestAuthenticator getDigestAuthenticator()
Returns the associated digest authenticator.- Returns:
- The associated digest authenticator.
-
setDigestAuthenticator
public void setDigestAuthenticator(DigestAuthenticator digestAuthenticator)
Sets the associated digest authenticator.- Parameters:
digestAuthenticator- The associated digest authenticator.
-
verify
public int verify(Request request, Response response)
Description copied from class:SecretVerifierVerifies that the proposed secret is correct for the specified request. By default, it compares the inputSecret of the request's authentication response with the one obtain by theChallengeResponse.getSecret()method and sets theUserinstance of the request'sClientInfoif successful.- Specified by:
verifyin interfaceVerifier- Overrides:
verifyin classSecretVerifier- Parameters:
request- The request to inspect.response- The response to inspect.- Returns:
- Result of the verification based on the RESULT_* constants.
-
-