Skip to content

Commit

Permalink
feat: added timeouts on auth retries and increased number of retries
Browse files Browse the repository at this point in the history
Signed-off-by: JANSSENB <[email protected]>
  • Loading branch information
JanssenBrm committed Feb 25, 2025
1 parent a4f74c7 commit 182d497
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/auth/bearer/bearer.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-http-bearer';
import { ConfigService } from '../../config/config/config.service';
import { Client, custom, IntrospectionResponse, Issuer } from 'openid-client';
import { UtilsService } from '../../utils/services/utils/utils.service';

export enum VERIFICATION_ERRORS {
NO_CLIENT = 'no_client',
Expand Down Expand Up @@ -33,7 +34,7 @@ export class BearerStrategy extends PassportStrategy(Strategy, 'bearer') {
logger: Logger;

constructor(client: Client) {
super({}, (token, verified) => this.verify(token, verified, 3));
super({}, (token, verified) => this.verify(token, verified, 5));
this.client = client;
this.logger = new Logger('BearerStrategy');
}
Expand All @@ -52,6 +53,7 @@ export class BearerStrategy extends PassportStrategy(Strategy, 'bearer') {
if (introspectResult.error !== VERIFICATION_ERRORS.GENERAL) {
break;
}
await UtilsService.sleep(1000);
attempt += 1;
}

Expand Down

0 comments on commit 182d497

Please sign in to comment.