File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,16 @@ export class OpenIDConnectAuth implements Authenticator {
33
33
}
34
34
35
35
private async getToken ( user : User , overrideClient ?: Client ) : Promise < string | null > {
36
+ if ( ! user . authProvider . config ) {
37
+ return null ;
38
+ }
39
+ if ( ! user . authProvider . config [ 'client-secret' ] ) {
40
+ user . authProvider . config [ 'client-secret' ] = '' ;
41
+ }
36
42
if (
37
43
! user . authProvider . config ||
38
44
! user . authProvider . config [ 'id-token' ] ||
39
45
! user . authProvider . config [ 'client-id' ] ||
40
- ! user . authProvider . config [ 'client-secret' ] ||
41
46
! user . authProvider . config [ 'refresh-token' ] ||
42
47
! user . authProvider . config [ 'idp-issuer-url' ]
43
48
) {
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ describe('OIDCAuth', () => {
70
70
expect ( opts . headers . Authorization ) . to . be . undefined ;
71
71
} ) ;
72
72
73
- it ( 'authorization should be undefined if client-secret missing' , async ( ) => {
73
+ it ( 'authorization should be work if client-secret missing' , async ( ) => {
74
74
const user = {
75
75
authProvider : {
76
76
name : 'oidc' ,
@@ -85,8 +85,9 @@ describe('OIDCAuth', () => {
85
85
86
86
const opts = { } as request . Options ;
87
87
opts . headers = [ ] ;
88
- await auth . applyAuthentication ( user , opts ) ;
89
- expect ( opts . headers . Authorization ) . to . be . undefined ;
88
+ ( auth as any ) . currentTokenExpiration = Date . now ( ) / 1000 + 1000 ;
89
+ await auth . applyAuthentication ( user , opts , { } ) ;
90
+ expect ( opts . headers . Authorization ) . to . equal ( 'Bearer fakeToken' ) ;
90
91
} ) ;
91
92
92
93
it ( 'authorization should be undefined if refresh-token missing' , async ( ) => {
You can’t perform that action at this time.
0 commit comments