본문 바로가기

Backend/파본것들

[nestjs] Authentication, bcrypt

Login Authentication LifeCycle

controller에 있는 @UseGuards가 사용자가 서버에 접속할 때, intercept해간다.

LocalAuthGuard에 명시된 local이 local.strategy.ts를 사용한다. local.strategy에서는 validate method를 실행하고 이 과정에서 authService에 있는 validateUser method를 통해 비밀번호를 비교한다. 만약 비밀번호가 일치한다면, login controller가 실행되고 authService에 있는 login method가 실행된다.

 

 

 참고한 블로그

https://docs.nestjs.com/security/authentication

 

Documentation | NestJS - A progressive Node.js framework

Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reac

docs.nestjs.com

 

https://nofunfromdev.tistory.com/entry/Nestjs-Login-Authentication-%EA%B5%AC%ED%98%84-passport-jwt-passport-local

 

[Nest.js] Login Authentication 구현 ( passport + jwt + local strategy )

사용자인증은 대부분의 애플리케이션에서 필수적인 부분이다. 인증을 처리하는 방법은 다양하지만 Nest.js 공식홈페이지에서 passport를 안내하고 있어 필자는 passport와 jwt를 선택했다. jwt 전략을

nofunfromdev.tistory.com

https://thinkforthink.tistory.com/211

 

bcrypt의 작동원리와 노드에서 사용하는 방법

1. 간단한 원리 bcrypt를 사용하면 매번 솔트가 달라지기 때문에 해시 역시도 달라지고 데이터베이스에 특정한 해시를 저장하더라도 보안에 문제가 되지 않는다. 해시가 그때그때마다 달라져 해

thinkforthink.tistory.com

https://codegear.tistory.com/71

 

[Nodejs 프레임워크]NestJS - 11. 비밀번호 암호화(bcrypt)

다음은 이 글의 동영상 강의 입니다. https://youtu.be/LbyfF6ALMo0 비밀번호 암호와의 필요성 회원 가입시 비밀번호를 그대로 저장하면 보안사고의 위험이 있습니다. 만약 고객의 정보가 노출되었을 경

codegear.tistory.com

 

'Backend > 파본것들' 카테고리의 다른 글

[nestjs] Module이란, 순환 참조 오류  (0) 2023.02.14
static 이란, 쓰는 이유  (0) 2023.01.30
const와 readonly의 차이  (0) 2023.01.28