-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #489 from boostcampwm2023/develop
[release] v1.0.1 배포
- Loading branch information
Showing
154 changed files
with
3,791 additions
and
1,094 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/app/backend/ @ldhbenecia @ccxz84 | ||
/app/frontend/ @ttaerrim @LEEJW1953 @js43o | ||
/packages/morak-ui @ttaerrim @LEEJW1953 @js43o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ lerna-debug.log* | |
|
||
# turbo | ||
.turbo | ||
|
||
# testing | ||
**/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
PORT= | ||
DOMAIN= | ||
SOCKET_PORT= | ||
GOOGLE_CLIENT_ID= | ||
GOOGLE_SECRET= | ||
GOOGLE_CALLBACK_URL= | ||
DATABASE_URL= | ||
JWT_ACCESS_SECRET= | ||
JWT_REFRESH_SECRET= | ||
DOMAIN= | ||
REDIS_PORT= | ||
REDIS_HOST= | ||
REDIS_MAX_AGE_REFRESH_TOKEN= | ||
MAX_AGE_ACCESS_TOKEN= | ||
MAX_AGE_REFRESH_TOKEN= | ||
VAULT_ADDR= | ||
VAULT_TOKEN= | ||
VAULT_SECRET_URL= | ||
DB_PORT= | ||
DB_PASSWORD= | ||
DB_USER= | ||
DB_DATABASE_NAME= | ||
DB_DATABASE_NAME= | ||
DB_PORT= | ||
DB_ROOT_PASSWORD= | ||
MONGO_HOST= | ||
MONGO_PORT= | ||
MONGO_CHAT_DB= | ||
CHAT_USER= | ||
CHAT_PASSWORD= | ||
DATABASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { Injectable, ExecutionContext, UnauthorizedException } from '@nestjs/common'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { AuthGuard } from '@nestjs/passport'; | ||
import { getSecret } from '@morak/vault'; | ||
|
||
@Injectable() | ||
export class AtGuard extends AuthGuard('jwt') {} | ||
export class AtGuard extends AuthGuard('jwt') { | ||
constructor(private jwtService: JwtService) { | ||
super(); | ||
} | ||
|
||
canActivate(context: ExecutionContext) { | ||
const request = context.switchToHttp().getRequest(); | ||
|
||
if (!request.cookies) { | ||
throw new UnauthorizedException('Unauthorized'); | ||
} | ||
|
||
const accessToken = request.cookies.access_token; | ||
|
||
try { | ||
const decodedToken = this.jwtService.verify(accessToken, { | ||
secret: getSecret('JWT_ACCESS_SECRET'), | ||
}); | ||
|
||
const { userId, providerId, socialType, email, profilePicture, nickname } = decodedToken; | ||
const userIdBigInt = BigInt(userId); | ||
|
||
request.user = { id: userIdBigInt, providerId, socialType, email, profilePicture, nickname }; | ||
|
||
return true; | ||
} catch (error) { | ||
throw new UnauthorizedException('Invalid access token'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { JwtPayload } from 'jsonwebtoken'; | ||
|
||
export interface Payload extends JwtPayload { | ||
userId: bigint; | ||
providerId: string; | ||
socialType: string; | ||
email: string; | ||
profilePicture: string; | ||
nickname: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.