jwt
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user