// Send an "unauthorized" response and an appropriate challenge
- // Next, generate a nOnce token (that is a token which is supposed
+ // Next, generate a nonce token (that is a token which is supposed
// to be unique).
String nonce = generateNonce(request);
* WWW-Authenticate = "WWW-Authenticate" ":" "Digest"
* digest-challenge
*
- * digest-challenge = 1#( realm | [ domain ] | nOnce |
+ * digest-challenge = 1#( realm | [ domain ] | nonce |
* [ digest-opaque ] |[ stale ] | [ algorithm ] )
*
* realm = "realm" "=" realm-value
* @param response HTTP Servlet response
* @param config Login configuration describing how authentication
* should be performed
- * @param nOnce nonce token
+ * @param nonce nonce token
*/
protected void setAuthenticateHeader(HttpServletRequest request,
HttpServletResponse response,
LoginConfig config,
- String nOnce,
+ String nonce,
boolean isNonceStale) {
// Get the realm name
String authenticateHeader;
if (isNonceStale) {
authenticateHeader = "Digest realm=\"" + realmName + "\", " +
- "qop=\"" + QOP + "\", nonce=\"" + nOnce + "\", " + "opaque=\"" +
+ "qop=\"" + QOP + "\", nonce=\"" + nonce + "\", " + "opaque=\"" +
getOpaque() + "\", stale=true";
} else {
authenticateHeader = "Digest realm=\"" + realmName + "\", " +
- "qop=\"" + QOP + "\", nonce=\"" + nOnce + "\", " + "opaque=\"" +
+ "qop=\"" + QOP + "\", nonce=\"" + nonce + "\", " + "opaque=\"" +
getOpaque() + "\"";
}
if (i < 0 || (i + 1) == nonce.length()) {
return false;
}
- long nOnceTime;
+ long nonceTime;
try {
- nOnceTime = Long.parseLong(nonce.substring(0, i));
+ nonceTime = Long.parseLong(nonce.substring(0, i));
} catch (NumberFormatException nfe) {
return false;
}
String md5clientIpTimeKey = nonce.substring(i + 1);
long currentTime = System.currentTimeMillis();
- if ((currentTime - nOnceTime) > nonceValidity) {
+ if ((currentTime - nonceTime) > nonceValidity) {
nonceStale = true;
return false;
}
String serverIpTimeKey =
- request.getRemoteAddr() + ":" + nOnceTime + ":" + key;
+ request.getRemoteAddr() + ":" + nonceTime + ":" + key;
byte[] buffer = null;
synchronized (md5Helper) {
buffer = md5Helper.digest(
*
* @param username Username of the Principal to look up
* @param clientDigest Digest which has been submitted by the client
- * @param nOnce Unique (or supposedly unique) token which has been used
+ * @param nonce Unique (or supposedly unique) token which has been used
* for this request
* @param realm Realm name
* @param md5a2 Second MD5 digest used to calculate the digest :
*/
@Override
public Principal authenticate(String username, String clientDigest,
- String nOnce, String nc, String cnonce,
+ String nonce, String nc, String cnonce,
String qop, String realm,
String md5a2) {
return null;
String serverDigestValue;
if (qop == null) {
- serverDigestValue = md5a1 + ":" + nOnce + ":" + md5a2;
+ serverDigestValue = md5a1 + ":" + nonce + ":" + md5a2;
} else {
- serverDigestValue = md5a1 + ":" + nOnce + ":" + nc + ":" +
+ serverDigestValue = md5a1 + ":" + nonce + ":" + nc + ":" +
cnonce + ":" + qop + ":" + md5a2;
}
if (log.isDebugEnabled()) {
log.debug("Digest : " + clientDigest + " Username:" + username
- + " ClientSigest:" + clientDigest + " nOnce:" + nOnce
+ + " ClientSigest:" + clientDigest + " nonce:" + nonce
+ " nc:" + nc + " cnonce:" + cnonce + " qop:" + qop
+ " realm:" + realm + "md5a2:" + md5a2
+ " Server digest:" + serverDigest);