Skip to content

Commit 7eb9b92

Browse files
stevebioanu3990
authored andcommitted
Re-add external www-authenticate library so we can show our changes in another commit..
Delete and re-add existing www-authenticate files to www-authenticate-patched. Change path for require for requester and tests. Changes to www-authenticate will be in subsequent commit, for tracking
1 parent fdfca96 commit 7eb9b92

File tree

6 files changed

+14
-27
lines changed

6 files changed

+14
-27
lines changed

lib/requester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright © 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33
*/
44
'use strict';
5-
var createAuthInitializer = require('./www-authenticate/www-authenticate');
5+
var createAuthInitializer = require('./www-authenticate-patched/www-authenticate');
66
var Kerberos = require('./optional.js')
77
.libraryProperty('kerberos', 'Kerberos');
88
var Multipart = require('multipart-stream');

lib/www-authenticate/md5.js renamed to lib/www-authenticate-patched/md5.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
var crypto= require('crypto');
1+
var crypto= require('crypto')
2+
, md5sum = crypto.createHash('md5')
3+
;
24

35
function md5(s) {
46
return crypto.createHash('md5').update(s).digest('hex');

lib/www-authenticate/parsers.js renamed to lib/www-authenticate-patched/parsers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ function Parse_WWW_Authenticate(to_parse)
8888
}
8989
}
9090

91+
Parse_Authentication_Info.prototype.parse_params= parse_params;
92+
9193
function Parse_Authentication_Info(to_parse)
9294
{
9395
this.scheme= 'Digest';
@@ -100,7 +102,6 @@ function Parse_Authentication_Info(to_parse)
100102
}
101103
}
102104

103-
Parse_Authentication_Info.prototype.parse_params= parse_params;
104105
Parse_WWW_Authenticate.prototype.parse_params= parse_params;
105106

106107
module.exports = {

lib/www-authenticate/user-credentials.js renamed to lib/www-authenticate-patched/user-credentials.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ function user_credentials(username,password,options) {
1616
''
1717
:
1818
(!password && password !== '' ?
19-
Buffer.from(username, "ascii").toString("base64")
19+
new Buffer(username, "ascii").toString("base64")
2020
:
21-
Buffer.from(username+':'+password, "ascii").toString("base64")
21+
new Buffer(username+':'+password, "ascii").toString("base64")
2222
)
2323
function Credentials()
2424
{

lib/www-authenticate/www-authenticate.js renamed to lib/www-authenticate-patched/www-authenticate.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* www-authenticate
34
* https://github.com/randymized/www-authenticate
@@ -6,13 +7,10 @@
67
* Licensed under the MIT license.
78
*/
89

9-
/*
10-
* Copyright © 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
11-
*/
12-
1310
'use strict';
1411

1512
var crypto= require('crypto')
13+
, md5sum = crypto.createHash('md5')
1614
, parsers= require('./parsers')
1715
, md5= require('./md5')
1816
, user_credentials= require('./user-credentials')
@@ -42,20 +40,6 @@ var www_authenticator = function(username,password,options)
4240
cnonce= options.cnonce;
4341
}
4442
if (cnonce === void 0) cnonce= crypto.pseudoRandomBytes(8).toString('hex');
45-
46-
/**
47-
* @typedef {Object} Authenticator
48-
* @property {any} [err]
49-
* @property {function(string=, string=): string} [authorize]
50-
* @property {any} [parms]
51-
* @property {string} [cnonce]
52-
*/
53-
54-
/**
55-
* Parses the WWW-Authenticate header.
56-
* @param {string} www_authenticate
57-
* @returns {Authenticator}
58-
*/
5943
var parse_header= function(www_authenticate)
6044
{
6145
function Authenticator()

test-basic/digestauth-fips-nomd5load.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ describe('FIPS test - ensure MD5 hash digester object is not loaded by default o
2222
* To simulate the require/load, we first delete the module from Node's require cache
2323
* and then require it again, which forces a reload of the module.
2424
*/
25-
delete require.cache[require.resolve('../lib/www-authenticate/www-authenticate')];
26-
delete require.cache[require.resolve('../lib/www-authenticate/md5')];
25+
delete require.cache[require.resolve('../lib/www-authenticate-patched/www-authenticate')];
26+
delete require.cache[require.resolve('../lib/www-authenticate-patched/md5')];
2727
const crypto = require('crypto');
2828
const originalCreateHash = crypto.createHash;
2929

@@ -40,8 +40,8 @@ describe('FIPS test - ensure MD5 hash digester object is not loaded by default o
4040
(() => crypto.createHash('md5')).should.throw('FIPS emulation: MD5 digest algorithm is not allowed on this system!');
4141

4242
// Require the module - should not call to get MD5 digester so should not throw
43-
(() => require('../lib/www-authenticate/md5')).should.not.throw();
44-
(() => require('../lib/www-authenticate/www-authenticate')).should.not.throw();
43+
(() => require('../lib/www-authenticate-patched/md5')).should.not.throw();
44+
(() => require('../lib/www-authenticate-patched/www-authenticate')).should.not.throw();
4545

4646
} finally {
4747
// Restore the original createHash function to avoid side effects

0 commit comments

Comments
 (0)