@@ -30,6 +30,8 @@ t.test('basic auth', t => {
30
30
const gotAuth = getAuth ( config . registry , config )
31
31
t . same ( gotAuth , {
32
32
scopeAuthKey : null ,
33
+ regKey : '//my.custom.registry/here/' ,
34
+ authKey : 'username' ,
33
35
token : null ,
34
36
isBasicAuth : true ,
35
37
auth : Buffer . from ( 'user:pass' ) . toString ( 'base64' ) ,
@@ -61,6 +63,8 @@ t.test('token auth', t => {
61
63
}
62
64
t . same ( getAuth ( `${ config . registry } /foo/-/foo.tgz` , config ) , {
63
65
scopeAuthKey : null ,
66
+ regKey : '//my.custom.registry/here/' ,
67
+ authKey : '_authToken' ,
64
68
isBasicAuth : false ,
65
69
token : 'c0ffee' ,
66
70
auth : null ,
@@ -107,6 +111,8 @@ t.test('forceAuth', t => {
107
111
}
108
112
t . same ( getAuth ( config . registry , config ) , {
109
113
scopeAuthKey : null ,
114
+ regKey : false ,
115
+ authKey : null ,
110
116
token : null ,
111
117
isBasicAuth : true ,
112
118
auth : Buffer . from ( 'user:pass' ) . toString ( 'base64' ) ,
@@ -140,6 +146,8 @@ t.test('forceAuth token', t => {
140
146
}
141
147
t . same ( getAuth ( config . registry , config ) , {
142
148
scopeAuthKey : null ,
149
+ regKey : false ,
150
+ authKey : null ,
143
151
isBasicAuth : false ,
144
152
token : 'cafebad' ,
145
153
auth : null ,
@@ -168,6 +176,8 @@ t.test('_auth auth', t => {
168
176
}
169
177
t . same ( getAuth ( `${ config . registry } /asdf/foo/bar/baz` , config ) , {
170
178
scopeAuthKey : null ,
179
+ regKey : '//my.custom.registry/here/' ,
180
+ authKey : '_auth' ,
171
181
token : null ,
172
182
isBasicAuth : false ,
173
183
auth : 'c0ffee' ,
@@ -195,6 +205,8 @@ t.test('_auth username:pass auth', t => {
195
205
}
196
206
t . same ( getAuth ( config . registry , config ) , {
197
207
scopeAuthKey : null ,
208
+ regKey : '//my.custom.registry/here/' ,
209
+ authKey : '_auth' ,
198
210
token : null ,
199
211
isBasicAuth : false ,
200
212
auth : auth ,
@@ -246,6 +258,8 @@ t.test('globally-configured auth', t => {
246
258
}
247
259
t . same ( getAuth ( basicConfig . registry , basicConfig ) , {
248
260
scopeAuthKey : null ,
261
+ regKey : '//different.registry/' ,
262
+ authKey : 'username' ,
249
263
token : null ,
250
264
isBasicAuth : true ,
251
265
auth : Buffer . from ( 'globaluser:globalpass' ) . toString ( 'base64' ) ,
@@ -261,6 +275,8 @@ t.test('globally-configured auth', t => {
261
275
}
262
276
t . same ( getAuth ( tokenConfig . registry , tokenConfig ) , {
263
277
scopeAuthKey : null ,
278
+ regKey : '//different.registry/' ,
279
+ authKey : '_authToken' ,
264
280
token : 'deadbeef' ,
265
281
isBasicAuth : false ,
266
282
auth : null ,
@@ -276,6 +292,8 @@ t.test('globally-configured auth', t => {
276
292
}
277
293
t . same ( getAuth ( `${ _authConfig . registry } /foo` , _authConfig ) , {
278
294
scopeAuthKey : null ,
295
+ regKey : '//different.registry' ,
296
+ authKey : '_auth' ,
279
297
token : null ,
280
298
isBasicAuth : false ,
281
299
auth : 'deadbeef' ,
@@ -296,6 +314,8 @@ t.test('otp token passed through', t => {
296
314
}
297
315
t . same ( getAuth ( config . registry , config ) , {
298
316
scopeAuthKey : null ,
317
+ regKey : '//my.custom.registry/here/' ,
318
+ authKey : '_authToken' ,
299
319
token : 'c0ffee' ,
300
320
isBasicAuth : false ,
301
321
auth : null ,
@@ -365,6 +385,8 @@ t.test('always-auth', t => {
365
385
}
366
386
t . same ( getAuth ( config . registry , config ) , {
367
387
scopeAuthKey : null ,
388
+ regKey : '//my.custom.registry/here/' ,
389
+ authKey : '_authToken' ,
368
390
token : 'c0ffee' ,
369
391
isBasicAuth : false ,
370
392
auth : null ,
@@ -399,6 +421,8 @@ t.test('scope-based auth', t => {
399
421
}
400
422
t . same ( getAuth ( config [ '@myscope:registry' ] , config ) , {
401
423
scopeAuthKey : null ,
424
+ regKey : '//my.custom.registry/here/' ,
425
+ authKey : '_authToken' ,
402
426
auth : null ,
403
427
isBasicAuth : false ,
404
428
token : 'c0ffee' ,
@@ -407,6 +431,8 @@ t.test('scope-based auth', t => {
407
431
} , 'correct auth token picked out' )
408
432
t . same ( getAuth ( config [ '@myscope:registry' ] , config ) , {
409
433
scopeAuthKey : null ,
434
+ regKey : '//my.custom.registry/here/' ,
435
+ authKey : '_authToken' ,
410
436
auth : null ,
411
437
isBasicAuth : false ,
412
438
token : 'c0ffee' ,
@@ -446,6 +472,8 @@ t.test('certfile and keyfile errors', t => {
446
472
'//my.custom.registry/here/:keyfile' : `${ dir } /nosuch.key` ,
447
473
} ) , {
448
474
scopeAuthKey : null ,
475
+ regKey : '//my.custom.registry/here/' ,
476
+ authKey : 'certfile' ,
449
477
auth : null ,
450
478
isBasicAuth : false ,
451
479
token : null ,
@@ -479,6 +507,8 @@ t.test('do not be thrown by other weird configs', t => {
479
507
const auth = getAuth ( uri , opts )
480
508
t . same ( auth , {
481
509
scopeAuthKey : null ,
510
+ regKey : '//localhost:15443/foo' ,
511
+ authKey : '_authToken' ,
482
512
token : 'correct bearer token' ,
483
513
isBasicAuth : false ,
484
514
auth : null ,
@@ -499,6 +529,8 @@ t.test('scopeAuthKey tests', t => {
499
529
500
530
t . same ( getAuth ( uri , { ...opts , spec : '@scope/foo@latest' } ) , {
501
531
scopeAuthKey : '//scope-host.com/' ,
532
+ regKey : '//scope-host.com/' ,
533
+ authKey : '_authToken' ,
502
534
auth : null ,
503
535
isBasicAuth : false ,
504
536
token : null ,
@@ -508,6 +540,8 @@ t.test('scopeAuthKey tests', t => {
508
540
509
541
t . same ( getAuth ( uri , { ...opts , spec : 'foo@npm:@scope/foo@latest' } ) , {
510
542
scopeAuthKey : '//scope-host.com/' ,
543
+ regKey : '//scope-host.com/' ,
544
+ authKey : '_authToken' ,
511
545
auth : null ,
512
546
isBasicAuth : false ,
513
547
token : null ,
@@ -517,6 +551,8 @@ t.test('scopeAuthKey tests', t => {
517
551
518
552
t . same ( getAuth ( uri , { ...opts , spec : '@other-scope/foo@npm:@scope/foo@latest' } ) , {
519
553
scopeAuthKey : '//scope-host.com/' ,
554
+ regKey : '//scope-host.com/' ,
555
+ authKey : '_authToken' ,
520
556
auth : null ,
521
557
isBasicAuth : false ,
522
558
token : null ,
@@ -526,6 +562,8 @@ t.test('scopeAuthKey tests', t => {
526
562
527
563
t . same ( getAuth ( uri , { ...opts , spec : '@scope/foo@npm:foo@latest' } ) , {
528
564
scopeAuthKey : null ,
565
+ regKey : false ,
566
+ authKey : null ,
529
567
auth : null ,
530
568
isBasicAuth : false ,
531
569
token : null ,
@@ -547,6 +585,8 @@ t.test('registry host matches, path does not, send auth', t => {
547
585
const uri = 'https://scope-host.com/blahblah/bloobloo/foo.tgz'
548
586
t . same ( getAuth ( uri , { ...opts , spec : '@scope/foo' } ) , {
549
587
scopeAuthKey : null ,
588
+ regKey : '//scope-host.com/scope/host/' ,
589
+ authKey : '_authToken' ,
550
590
token : 'c0ffee' ,
551
591
auth : null ,
552
592
isBasicAuth : false ,
@@ -555,6 +595,8 @@ t.test('registry host matches, path does not, send auth', t => {
555
595
} )
556
596
t . same ( getAuth ( uri , { ...opts , spec : '@other-scope/foo' } ) , {
557
597
scopeAuthKey : '//other-scope-registry.com/other/scope/' ,
598
+ regKey : '//other-scope-registry.com/other/scope/' ,
599
+ authKey : '_authToken' ,
558
600
token : null ,
559
601
auth : null ,
560
602
isBasicAuth : false ,
@@ -563,6 +605,8 @@ t.test('registry host matches, path does not, send auth', t => {
563
605
} )
564
606
t . same ( getAuth ( uri , { ...opts , registry : 'https://scope-host.com/scope/host/' } ) , {
565
607
scopeAuthKey : null ,
608
+ regKey : '//scope-host.com/scope/host/' ,
609
+ authKey : '_authToken' ,
566
610
token : 'c0ffee' ,
567
611
auth : null ,
568
612
isBasicAuth : false ,
0 commit comments