Security
-
개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 마지막 글인 user 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthent..
Spring - Spring Security 6 + JWT 로그인, 로그아웃(최종편 - user 파일)개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 마지막 글인 user 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthent..
2024.07.21 -
개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 세번째 글인 jwt 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthenti..
Spring - Spring Security 6 + JWT 로그인, 로그아웃(3편 - jwt 파일)개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 세번째 글인 jwt 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthenti..
2024.07.21 -
개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 두번째 글인 global 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthe..
Spring - Spring Security 6 + JWT 로그인, 로그아웃(2편 - global 파일)개요Spring Security 6 + JWT 로그인, 로그아웃 과정의 두번째 글인 global 패키지에 대한 글이다.파일 구조/src/main/java/project├── global│ ├── config│ │ └── security│ │ └── SecurityConfig.java│ └── entity│ └── AuditingFields.java├── jwt│ ├── entity│ │ └── Token.java│ ├── filter│ │ └── TokenAuthenticationFilter.java│ ├── infrastructure│ │ ├── CustomUserDetails.java│ │ └── JwtAuthe..
2024.07.21 -
개요마음에 드는 설명글을 찾지 못해 거의 일주일의 시간을 잡아먹은 Spring Security 6 + JWT 로그인, 로그아웃 기능 구현을 완료했다.정리가 꼭 필요한 과정인 것 같아 포스팅을 하기로 했다.이 글은 그 포스팅 중 첫번째 글인 기본 세팅에 대한 설명 글이다.버전- Spring boot : 3.3.1- Spring Security : 6.3.1- jjwt : 0.11.5- 설계 방식 : DDD (Domain-Driven Design)필요한 환경변수 세팅값1. jwt.accessSecret - 엑세스 토큰 시크릿 키2. jwt.refreshSecret - 리프레시 토큰 시크릿 키3. jwt.accessTokenExpire - 엑세스 토큰 만료 시간4. jwt.refreshTokenExpire -..
Spring - Spring Security 6 + JWT 로그인, 로그아웃(1편 - 기본 세팅)개요마음에 드는 설명글을 찾지 못해 거의 일주일의 시간을 잡아먹은 Spring Security 6 + JWT 로그인, 로그아웃 기능 구현을 완료했다.정리가 꼭 필요한 과정인 것 같아 포스팅을 하기로 했다.이 글은 그 포스팅 중 첫번째 글인 기본 세팅에 대한 설명 글이다.버전- Spring boot : 3.3.1- Spring Security : 6.3.1- jjwt : 0.11.5- 설계 방식 : DDD (Domain-Driven Design)필요한 환경변수 세팅값1. jwt.accessSecret - 엑세스 토큰 시크릿 키2. jwt.refreshSecret - 리프레시 토큰 시크릿 키3. jwt.accessTokenExpire - 엑세스 토큰 만료 시간4. jwt.refreshTokenExpire -..
2024.07.21 -
개요spring security + jwt 기초 세팅을 하던 중 블로그를 둘러보면 다들 jwt 시크릿 키가 있는데 어디서 만드는 지 몰라 찾아보았다.jwt 공식 사이트에서 만들어주는 건가 했는데 찾아본 결과 그냥 마음대로 만드는 거였다.직접 만들기도 귀찮으니 랜덤으로 만들어주는 터미널 명령어를 찾아보았다.명령어# OpenSSL을 사용하여 64바이트 길이의 난수 값을 16진수(hex) 형식으로 생성openssl rand -hex 64
JWT - JWT 시크릿 키 생성개요spring security + jwt 기초 세팅을 하던 중 블로그를 둘러보면 다들 jwt 시크릿 키가 있는데 어디서 만드는 지 몰라 찾아보았다.jwt 공식 사이트에서 만들어주는 건가 했는데 찾아본 결과 그냥 마음대로 만드는 거였다.직접 만들기도 귀찮으니 랜덤으로 만들어주는 터미널 명령어를 찾아보았다.명령어# OpenSSL을 사용하여 64바이트 길이의 난수 값을 16진수(hex) 형식으로 생성openssl rand -hex 64
2024.07.15 -
개요Spring Security 설정을 만져주던 중 "/join" 경로를 허용해줬는데도 계속 403 에러가 발생해 피눈물이 나던 중 겨우겨우 해결해서 글을 남긴다.설명설정이 잘못돼서 에러가 발생하는 경우도 있겠지만 나의 경우는 허용한 페이지 접속 시 이런저런 이유로 에러가 발생했는데 그 때 이동되는 "/error" 페이지는 허용이 되어있지 않아서 발생하는 오류였다.해결방법"/error" 페이지도 허용을 해준다.// 전// 경로별 인가http.authorizeHttpRequests(auth -> auth .requestMatchers("/", "/join").permitAll() // 메인, 회원가입 페이지 허용 .anyRequest().authenticated());// 후// ..
Spring - Spring Security 허용했는데 403 에러 발생개요Spring Security 설정을 만져주던 중 "/join" 경로를 허용해줬는데도 계속 403 에러가 발생해 피눈물이 나던 중 겨우겨우 해결해서 글을 남긴다.설명설정이 잘못돼서 에러가 발생하는 경우도 있겠지만 나의 경우는 허용한 페이지 접속 시 이런저런 이유로 에러가 발생했는데 그 때 이동되는 "/error" 페이지는 허용이 되어있지 않아서 발생하는 오류였다.해결방법"/error" 페이지도 허용을 해준다.// 전// 경로별 인가http.authorizeHttpRequests(auth -> auth .requestMatchers("/", "/join").permitAll() // 메인, 회원가입 페이지 허용 .anyRequest().authenticated());// 후// ..
2024.07.13 -
코드import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.security.config.annotation.web.builders.HttpSecurity;import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;import org.springframework.security.web.SecurityFilterChain;import org.springframework.security.web.util.matcher.An..
Spring - Spring Security 6버전 모든 요청 허용코드import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.security.config.annotation.web.builders.HttpSecurity;import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;import org.springframework.security.web.SecurityFilterChain;import org.springframework.security.web.util.matcher.An..
2024.07.12