본문 바로가기

스프링 & Jpa/📌Spring Security 강좌3

인프런 시큐리티 강좌 #3 - jwt 📌 JWT 동작 원리 ▸ MyFilter3.java public class MyFilter3 implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; if(req.getMethod().equals("POST")){ String headerAuth = req.getHeader("Aut.. 2022. 1. 22.
인프런 시큐리티 강좌 #2 - security 기본 📌 JWT library https://mvnrepository.com/artifact/com.auth0/java-jwt/3.18.2 📌 프로젝트 생성 plugins { id 'org.springframework.boot' version '2.6.3' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' } group = 'com' version = '0.0.1-SNAPSHOT' sourceCompatibility = '11' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { /.. 2022. 1. 21.
인프런 시큐리티 강좌 #1 - 도입 📌 Session JWT가 왜 사용되는지 이해하는 것이 중요하다. ▸ 세션의 동작 원리 서버에 첫 요청을 보내면, 서버는 사용자를 사용자 인증 페이지로 보낸다. 사용자는 id, password를 입력하고, 서버는 검증한다. 검증된 사용자면 session에 사용자를 등록하고 session id를 반환한다. 사용자는 다음 요청부터는 session id만 반환하면 사이트를 이용할 수 있다. ▸ 세션 인증이 종료되는 방법 서버가 세션을 날려버리기 사용자 브라우저 종료 특정 시간이 지나면( 보통 30분이 지나면 서버에서 열린 세션 종료를 한다 ) ▸ 세션의 단점 서버가 가질 수 있는 세션의 크기는 한정적이다. 그래서 세션 방식으로 서버를 구성하려면 서버를 여러 대 두어서 load balancing을 해야 한다. .. 2022. 1. 19.