Browse Source

fix the source review ( api-key.strategy.ts )

pull/4270/merge^2
HarukaKishida 2 months ago
parent
commit
b2147bd284
  1. 7
      apps/api/src/app/auth/api-key.strategy.ts

7
apps/api/src/app/auth/api-key.strategy.ts

@ -24,12 +24,13 @@ export class ApiKeyStrategy extends PassportStrategy(
super({ header: HEADER_KEY_TOKEN, prefix: 'Api-Key ' }, true);
}
public validate = async (
public async validate(
apiKey: string,
done: (error: any, user?: any) => void
) => {
) {
try {
const user = await this.validateApiKey(apiKey);
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
if (hasRole(user, 'INACTIVE')) {
throw new HttpException(
@ -52,7 +53,7 @@ export class ApiKeyStrategy extends PassportStrategy(
} catch (error) {
done(error, null);
}
};
}
private async validateApiKey(apiKey: string) {
if (!apiKey) {

Loading…
Cancel
Save