Spring Security
Spring Security + JWT 적용하기(2) - 게시판 만들기(11)
Spring Security에 JWT를 붙이기 전에 JWT를 먼저 발급해 보겠다. 로그인 시 JWT 발급하기 먼저 JWT에 대한 작업을 할 클래스를 하나 생성한다. Security와 같은 모듈에서 utils 패키지를 만들어 관리를 할 것이다. 그러기 전에 먼저 의존성을 추가해 준다. build.gradle (common-authentication 모듈) dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' //Spring Security implementation 'io.jsonwebtoken:jjwt:0.9.1' } jjwt 가 java json web. token이라고 한다. utils/JwtUtil ..
Spring Security + JWT 적용하기(1) - 게시판 만들기(10)
코드를 작성하기 전에 Spring Security가 무엇이고 왜 사용해야 하는지 알아보았다. Spring Security란? Spring 기반으로 어플리케이션 보안(인증, 권한, 인가 등) 기능을 제공하는 스프링 하위 프레임워크. Spring Security는 인증과 권한에 대한 부분을 Filter 흐름에 따라 처리한다. 이 Filter는 Dispatcher Servlet으로 가기 전에 적용되기 때문에 가장 먼저 URL의 요청을 받는다. Interceptor와는 다른 점이 Interceptor는 Dispatcher Servlet과 Controller 사이에 위치하기 때문에 적용되는 시점이 다른 차이가 있다. Spring Security는 보안과 관련하여 쳬계적으로 많은 옵션을 제공하기 때문에 개발자의 입..