seguridad implementada
This commit is contained in:
parent
4c4b1b1d85
commit
d1ed756ddf
@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy, ExtractJwt } from 'passport-jwt';
|
||||
import { JwtPayload } from '../dto/jwt-payload';
|
||||
|
||||
@Injectable()
|
||||
export class JwtStrategyService extends PassportStrategy(Strategy) {
|
||||
@ -11,4 +12,6 @@ export class JwtStrategyService extends PassportStrategy(Strategy) {
|
||||
secretOrKey: configService.get<string>('AUTH_SECRETKEY'),
|
||||
});
|
||||
}
|
||||
|
||||
validate(payload: JwtPayload) {}
|
||||
}
|
||||
|
@ -1,10 +1,19 @@
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { UsuarioService } from './usuario.service';
|
||||
import { UsuarioEscolaresDto } from './dto/usuario-escolares.dto';
|
||||
import { UsuarioRegistrarDto } from './dto/usuario-registrar.dto';
|
||||
import { UsuarioUpdateDto } from './dto/usuario-update.dto';
|
||||
import { UsuarioUsuariosDto } from './dto/usuario-usuarios.dto';
|
||||
import { UsuarioDto } from './dto/usuario.dto';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Controller('usuario')
|
||||
export class UsuarioController {
|
||||
@ -15,6 +24,7 @@ export class UsuarioController {
|
||||
escolares(@Query() query: UsuarioEscolaresDto) {}
|
||||
|
||||
@Post('registrar')
|
||||
// @UseGuards(AuthGuard('jwt'))
|
||||
registrar(@Body() body: UsuarioRegistrarDto) {
|
||||
return this.usuarioService.registrar(body.id_usuario, body.telefono);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { UsuarioController } from './usuario.controller';
|
||||
import { UsuarioService } from './usuario.service';
|
||||
@ -10,6 +11,7 @@ import { TipoUsuarioModule } from '../tipo-usuario/tipo-usuario.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
PassportModule.register({ defaultStrategy: 'jwt' }),
|
||||
TypeOrmModule.forFeature([Usuario]),
|
||||
BcryptModule,
|
||||
// CarreraModule,
|
||||
|
Loading…
Reference in New Issue
Block a user