Skip to content

Commit 36a330e

Browse files
committed
PM-2131 - allow other types of authentication tokens throughout the app
1 parent 4bd1f23 commit 36a330e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/shared/guards/gitea-webhook-auth.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class GiteaWebhookAuthGuard implements CanActivate {
4545
throw new BadRequestException('Missing authorization header');
4646
}
4747

48-
if (authHeader !== `Bearer ${auth}`) {
48+
if (authHeader !== `SecretKey ${auth}`) {
4949
this.logger.error('Invalid authorization header');
5050
throw new ForbiddenException('Invalid authorization');
5151
}

src/shared/request/tokenRequestValidator.middleware.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export class TokenValidatorMiddleware implements NestMiddleware {
2222

2323
const [type, idToken] = request.headers.authorization.split(' ') ?? [];
2424

25-
if (type !== 'Bearer' || !idToken) {
25+
if (type !== 'Bearer') {
26+
return next();
27+
}
28+
29+
if (!idToken) {
2630
throw new UnauthorizedException('Invalid or missing JWT!');
2731
}
2832

0 commit comments

Comments
 (0)