Skip to content

Commit

Permalink
Pass on 'opaque' field
Browse files Browse the repository at this point in the history
As required by RFC2617 (section 3.2.1)
  • Loading branch information
raboof committed Aug 3, 2014
1 parent a3619a0 commit f268b7d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion digestAuthRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function digestAuthRequest(method, url, username, password) {
this.realm = null; // server issued realm
this.qop = null; // "quality of protection" - '' or 'auth' or 'auth-int'
this.response = null; // hashed response to server challenge
this.opaque = null; // hashed response to server challenge
this.nc = 1; // nonce count - increments with each request used with the same nonce
this.cnonce = null; // client nonce

Expand Down Expand Up @@ -83,6 +84,10 @@ function digestAuthRequest(method, url, username, password) {
if (key.match(/nonce/i) != null) {
self.nonce = val;
}
// find opaque
if (key.match(/opaque/i) != null) {
self.opaque = val;
}
// find QOP
if (key.match(/qop/i) != null) {
self.qop = val;
Expand Down Expand Up @@ -130,6 +135,7 @@ function digestAuthRequest(method, url, username, password) {
'nonce="'+self.nonce+'", '+
'uri="'+url+'", '+
'response="'+self.response+'", '+
'opaque="'+self.opaque+'", '+
'qop='+self.qop+', '+
'nc='+('00000000' + self.nc).slice(-8)+', '+
'cnonce="'+self.cnonce+'"';
Expand Down Expand Up @@ -204,4 +210,4 @@ function digestAuthRequest(method, url, username, password) {
if (self.request.readyState != 4) self.request.abort();
}
}
}
}

0 comments on commit f268b7d

Please sign in to comment.