|
|
@ -15,10 +15,10 @@ import { OidcStateStore } from './oidc-state.store'; |
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class OidcStrategy extends PassportStrategy(Strategy, 'oidc') { |
|
|
export class OidcStrategy extends PassportStrategy(Strategy, 'oidc') { |
|
|
private readonly logger = new Logger(OidcStrategy.name); |
|
|
|
|
|
|
|
|
|
|
|
private static readonly stateStore = new OidcStateStore(); |
|
|
private static readonly stateStore = new OidcStateStore(); |
|
|
|
|
|
|
|
|
|
|
|
private readonly logger = new Logger(OidcStrategy.name); |
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private readonly authService: AuthService, |
|
|
private readonly authService: AuthService, |
|
|
options: StrategyOptions |
|
|
options: StrategyOptions |
|
|
@ -48,11 +48,6 @@ export class OidcStrategy extends PassportStrategy(Strategy, 'oidc') { |
|
|
params?.sub ?? |
|
|
params?.sub ?? |
|
|
context?.claims?.sub; |
|
|
context?.claims?.sub; |
|
|
|
|
|
|
|
|
const jwt = await this.authService.validateOAuthLogin({ |
|
|
|
|
|
thirdPartyId, |
|
|
|
|
|
provider: Provider.OIDC |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (!thirdPartyId) { |
|
|
if (!thirdPartyId) { |
|
|
this.logger.error( |
|
|
this.logger.error( |
|
|
`Missing subject identifier in OIDC response from ${issuer}` |
|
|
`Missing subject identifier in OIDC response from ${issuer}` |
|
|
@ -61,6 +56,11 @@ export class OidcStrategy extends PassportStrategy(Strategy, 'oidc') { |
|
|
throw new Error('Missing subject identifier in OIDC response'); |
|
|
throw new Error('Missing subject identifier in OIDC response'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const jwt = await this.authService.validateOAuthLogin({ |
|
|
|
|
|
thirdPartyId, |
|
|
|
|
|
provider: Provider.OIDC |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
return { jwt }; |
|
|
return { jwt }; |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
this.logger.error(error); |
|
|
this.logger.error(error); |
|
|
|