Commit 2b95b0e 1 parent e0ab216 commit 2b95b0e Copy full SHA for 2b95b0e
File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ import { errorWithResponse } from './http.js';
16
16
* @param {Context } ctx
17
17
*/
18
18
export async function assertAuthorization ( ctx ) {
19
- let actual ;
19
+ let actual = ctx . attributes . key ;
20
20
if ( typeof ctx . attributes . key === 'undefined' ) {
21
21
ctx . attributes . key = ctx . info . headers . authorization ?. slice ( 'Bearer ' . length ) ;
22
22
actual = ctx . attributes . key ;
23
23
}
24
24
if ( actual === ctx . env . SUPERUSER_KEY ) {
25
- ctx . log . info ( 'acting as superuser' ) ;
25
+ ctx . log . debug ( 'acting as superuser' ) ;
26
26
return ;
27
27
}
28
28
Original file line number Diff line number Diff line change @@ -31,9 +31,15 @@ export const DEFAULT_CONTEXT = (
31
31
log : console ,
32
32
...overrides ,
33
33
attributes : {
34
+ key : 'test-key' ,
34
35
...( overrides . attributes ?? { } ) ,
35
36
} ,
36
37
env : {
38
+ SUPERUSER_KEY : 'su-test-key' ,
39
+ KEYS : {
40
+ // @ts -ignore
41
+ get : async ( ) => 'test-key' ,
42
+ } ,
37
43
CONFIGS : {
38
44
// @ts -ignore
39
45
get : async ( id ) => configMap [ id ] ,
You can’t perform that action at this time.
0 commit comments