Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/auth/dto/user.session.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { UserDto } from './user.dto';
export class UserSessionDto extends UserDto {
iat?: number; // JWT 발급 시간
ext?: number; // JWT 만료 시간
image_url: string; // 42 프로필 이미지 URI
image_url?: string; // 42 프로필 이미지 URI
email: string; // 42 이메일
}
23 changes: 22 additions & 1 deletion src/auth/guard/jwt-sign.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,28 @@ export class JWTSignGuard implements CanActivate {
this.logger.error(`can't generate JWTToken`);
return false;
}
const token = this.jwtService.sign(user);

// note: intra id가 지워지는 일이 있어 DB 변경 전까지 임시 처리 (하네DB는 새 인트라 정보가 업데이트 되지 않음)
// 157970+woosupar -> 215242+woospark

let jwtPayload: UserSessionDto;

if (user.user_id === 215242) {
jwtPayload = {
user_id: 157970,
login: 'woosupar',
is_staff: user.is_staff,
iat: user.iat,
ext: user.ext,
image_url: user.image_url,
email: user.email,
};
} else {
jwtPayload = { ...user };
}

const token = this.jwtService.sign(jwtPayload);

const host = request.headers.host;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, ...words] = host.split('.');
Expand Down