first commit

This commit is contained in:
2026-04-20 15:12:16 +03:00
commit 28f7241bcd
172 changed files with 21907 additions and 0 deletions
@@ -0,0 +1,24 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { JwtPayload } from '../../../common/interfaces/jwt-payload.interface';
@Injectable()
export class SuperAdminJwtStrategy extends PassportStrategy(Strategy, 'superadmin-jwt') {
constructor(configService: ConfigService) {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: configService.get<string>('superAdmin.accessSecret', { infer: true }),
});
}
validate(payload: JwtPayload): JwtPayload {
if (payload.tokenType !== 'superadmin_access') {
throw new UnauthorizedException('Invalid superadmin token');
}
return payload;
}
}