Skip to content

Commit

Permalink
Merge pull request #118 from boostcampwm-2024/feat/#49/setting-passport
Browse files Browse the repository at this point in the history
[Feat] passport 모듈 기초세팅
  • Loading branch information
begong313 authored Nov 10, 2024
2 parents fcb1a09 + dd05fcc commit 45c2366
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.3.0",
"@nestjs/core": "^10.0.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^8.0.1",
"@nestjs/typeorm": "^10.0.2",
"@repo/shared": "workspace:*",
"@repo/types": "workspace:*",
"bcrypt": "^5.1.1",
"mysql2": "^3.11.3",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
"passport-local": "^1.0.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
"typeorm": "^0.3.20"
Expand All @@ -41,9 +47,13 @@
"@nestjs/testing": "^10.0.0",
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@types/bcrypt": "^5.0.2",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/passport-github2": "^1.2.9",
"@types/passport-google-oauth20": "^2.0.16",
"@types/passport-local": "^1.0.38",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { Module } from '@nestjs/common';

import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { GithubStrategy } from './strategy/github.strategy';
import { GoogleStrategy } from './strategy/google.strategy';
import { LocalStrategy } from './strategy/local.strategy';

@Module({
controllers: [AuthController],
providers: [AuthService, LocalStrategy, GithubStrategy, GoogleStrategy],
})
export class AuthModule {}
4 changes: 4 additions & 0 deletions apps/api/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class AuthService {}
6 changes: 6 additions & 0 deletions apps/api/src/auth/strategy/github.strategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-github2';

@Injectable()
export class GithubStrategy extends PassportStrategy(Strategy, 'github') {}
6 changes: 6 additions & 0 deletions apps/api/src/auth/strategy/google.strategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-github2';

@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {}
6 changes: 6 additions & 0 deletions apps/api/src/auth/strategy/local.strategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-github2';

@Injectable()
export class LocalStrategy extends PassportStrategy(Strategy) {}
2 changes: 2 additions & 0 deletions apps/api/src/user/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from '@/entity/user.entity';

import { UserController } from './user.controller';
import { UserService } from './user.service';

@Module({
controllers: [UserController],
imports: [TypeOrmModule.forFeature([User])],
providers: [UserService],
})
export class UserModule {}
4 changes: 4 additions & 0 deletions apps/api/src/user/user.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class UserService {}
Loading

0 comments on commit 45c2366

Please sign in to comment.