This commit is contained in:
Drakthor475
2025-10-21 14:01:53 -06:00
parent ce2c283778
commit e2b8f86c74
15 changed files with 493 additions and 15 deletions
+19
View File
@@ -0,0 +1,19 @@
import { PassportStrategy } from "@nestjs/passport";
import{ExtractJwt,Strategy} from 'passport-jwt'
export class JwtStrategy extends PassportStrategy(Strategy){
constructor(){
super({
jwtFromRequest:ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration:false,
secretOrKey:process.env.JWT
});
}
async validate(dataUser:any){
return {
id: dataUser.id,
nombre: dataUser.nombre,
tipoUsuario: dataUser.tipoUsuario,
};
}
}