refactor: 重构后端鉴权方式
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
||||
import { OssService } from './oss.service';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { AuthGuard } from 'src/auth/guards/auth.guard';
|
||||
|
||||
@Controller('oss')
|
||||
export class OssController {
|
||||
constructor(private readonly ossService: OssService) {}
|
||||
constructor(private readonly ossService: OssService) { }
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@UseGuards(AuthGuard)
|
||||
@Get('sts')
|
||||
async getStsToken(@Request() req) {
|
||||
const { userId } = req.user;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { OssService } from './oss.service';
|
||||
import { OssController } from './oss.controller';
|
||||
import { AuthModule } from 'src/auth/auth.module';
|
||||
import { UserModule } from 'src/user/user.module';
|
||||
|
||||
@Module({
|
||||
providers: [OssService],
|
||||
controllers: [OssController],
|
||||
imports: [AuthModule, UserModule],
|
||||
})
|
||||
export class OssModule {}
|
||||
export class OssModule { }
|
||||
|
||||
Reference in New Issue
Block a user