Java/Spring
-
Spring Security 로 로그인 구현 하다보니 WebSecurityConfigurerAdapter 가 Deprecated 되어 있는걸 확인했다. 평소에 로그인 구현했던 방법은 WebSecurityConfigurerAdapter 를 상속받아 configure 메소드들을 오버라이드 하여 구현했습니다. 하지만 이제 WebSecurityConfigurerAdapter 가 deprecated 되어 사용할 수 없다보니 다른 방법으로 구현해야 합니다. WebSecurityConfigurerAdapter 공식문서를 보면 아래와 같이 나와있다. Deprecated. Use a SecurityFilterChain Bean to configure HttpSecurity or a WebSecurityCustomizer..
[Spring Boot] Spring Security WebSecurityConfigurerAdapter Deprecated 로 인해 Security 설정 바꿔보기Spring Security 로 로그인 구현 하다보니 WebSecurityConfigurerAdapter 가 Deprecated 되어 있는걸 확인했다. 평소에 로그인 구현했던 방법은 WebSecurityConfigurerAdapter 를 상속받아 configure 메소드들을 오버라이드 하여 구현했습니다. 하지만 이제 WebSecurityConfigurerAdapter 가 deprecated 되어 사용할 수 없다보니 다른 방법으로 구현해야 합니다. WebSecurityConfigurerAdapter 공식문서를 보면 아래와 같이 나와있다. Deprecated. Use a SecurityFilterChain Bean to configure HttpSecurity or a WebSecurityCustomizer..
2022.11.04 -
환경구성 : Spring Boot, Thymeleaf, Spring Security Spring Boot, Spring Security 구성이며 아이디, 패스워드를 RSA 암호화를 통해 서버로 전송하려고 RSA 공개키 요청중에 /auth/login/main 으로 Redirect가 되는 에러를 만났다. 요청은 아래와 같습니다. Spring Security Config AuthController left.html위와 같이 Spring Security Config 에 따로 csrf() 설정을 하지 않았으므로 enabled(활성화) 되어 있고post 요청을 하게 되면 302 Redirect가 발생합니다. 원인Spring Security 의 CSRF 설정 때문입니다.기본적으로 Spring Security 는..
[Spring Boot] Ajax 요청시 302 Redirect (302 에러)환경구성 : Spring Boot, Thymeleaf, Spring Security Spring Boot, Spring Security 구성이며 아이디, 패스워드를 RSA 암호화를 통해 서버로 전송하려고 RSA 공개키 요청중에 /auth/login/main 으로 Redirect가 되는 에러를 만났다. 요청은 아래와 같습니다. Spring Security Config AuthController left.html위와 같이 Spring Security Config 에 따로 csrf() 설정을 하지 않았으므로 enabled(활성화) 되어 있고post 요청을 하게 되면 302 Redirect가 발생합니다. 원인Spring Security 의 CSRF 설정 때문입니다.기본적으로 Spring Security 는..
2022.11.01 -
환경 구성 Spring Boot Spring Security Thymeleaf 1. Spring Security 를 사용하기 위한 라이브러리 의존성 설정 Spring Boot pom.xml 파일에 아래와 같이 dependency 추가 org.springframework.boot spring-boot-starter-security 위 dependency 추가 후 프로젝트 마우스 오른쪽 클릭 > Maven > Update Project... 실행 2. Spring Security Config 파일 생성 아래와 같이 SecurityConfig 자바 클래스 생성(본인이 생성한 경로이기 때문에 패키지명, 파일명은 알아서 설정해도됨) 생성 후 아래와 같이 SecurityConfig 파일 설정 SecurityConf..
[Spring Boot] Spring Security를 이용한 로그인 설정환경 구성 Spring Boot Spring Security Thymeleaf 1. Spring Security 를 사용하기 위한 라이브러리 의존성 설정 Spring Boot pom.xml 파일에 아래와 같이 dependency 추가 org.springframework.boot spring-boot-starter-security 위 dependency 추가 후 프로젝트 마우스 오른쪽 클릭 > Maven > Update Project... 실행 2. Spring Security Config 파일 생성 아래와 같이 SecurityConfig 자바 클래스 생성(본인이 생성한 경로이기 때문에 패키지명, 파일명은 알아서 설정해도됨) 생성 후 아래와 같이 SecurityConfig 파일 설정 SecurityConf..
2022.10.31 -
Lombok 이란 롬복(Lombok)은 간단한 어노테이션을 사용하여 반복 사용되는 DTO 의 getter/setter, toString(), 생성자 함수 등 자동 생성해줌으로써 코드를 줄여준다. DTO 에 변수명이나 추가할 변수가 있을 경우 재생성하는 불편함이 없어진다. 1. Lombok 의존성 추가 pom.xml 에 아래와 같이 의존성을 추가해준다. org.projectlombok lombok true pom.xml 에 의존성 추가 후 Maven Update 를 통해 라이브러리를 다운로드 받습니다. lombok을 설치했으나 컴파일 시 새로운 플러그인 에러 이슈 때문에 아래와 같이 설정도 해줘야한다. 2. Lombok 다운로드 https://projectlombok.org/download Download..
lombok 설정Lombok 이란 롬복(Lombok)은 간단한 어노테이션을 사용하여 반복 사용되는 DTO 의 getter/setter, toString(), 생성자 함수 등 자동 생성해줌으로써 코드를 줄여준다. DTO 에 변수명이나 추가할 변수가 있을 경우 재생성하는 불편함이 없어진다. 1. Lombok 의존성 추가 pom.xml 에 아래와 같이 의존성을 추가해준다. org.projectlombok lombok true pom.xml 에 의존성 추가 후 Maven Update 를 통해 라이브러리를 다운로드 받습니다. lombok을 설치했으나 컴파일 시 새로운 플러그인 에러 이슈 때문에 아래와 같이 설정도 해줘야한다. 2. Lombok 다운로드 https://projectlombok.org/download Download..
2022.10.26 -
Spring Boot 에서 thymeleaf-layout-dialect 라이브러리를 사용하여 Thymeleaf 템플릿 엔진에 레이아웃을 설정한다. 기본적인 Spring Boot Thymeleaf 설정은 아래 URL을 통해 설정해주세요https://okimaru.tistory.com/255 Spring Boot Thymeleaf 설정1. Spring Boot Project 생성 2. Spring Boot Thymeleaf dependency 추가 2-1. pom.xml 에 dependency 추가 org.springframework.boot spring-boot-starter-thymeleaf 2-2. Maven Update pom.xml에 thymeleaf..okimaru.tistory.com 1...
Spring Boot Thymeleaf Dialect Layout 설정Spring Boot 에서 thymeleaf-layout-dialect 라이브러리를 사용하여 Thymeleaf 템플릿 엔진에 레이아웃을 설정한다. 기본적인 Spring Boot Thymeleaf 설정은 아래 URL을 통해 설정해주세요https://okimaru.tistory.com/255 Spring Boot Thymeleaf 설정1. Spring Boot Project 생성 2. Spring Boot Thymeleaf dependency 추가 2-1. pom.xml 에 dependency 추가 org.springframework.boot spring-boot-starter-thymeleaf 2-2. Maven Update pom.xml에 thymeleaf..okimaru.tistory.com 1...
2022.10.06 -
ObjectMapper JSON 형태의 데이터를 String 또는 다른형태로 변환하거나 다른 타입의 json 데이터를 Json 타입의 데이터로 변환할 때 많이 사용한다. 1. Object => String @Getter @Setter public class User { int seq; String name; String number; public User(int seq, String name, String number){ this.seq = seq; this.name = name; this.number = number; } } 위와 같이 User 라는 Object 가 존재한다. 위 Object를 생성하면서 값을 지정하고 String 형 데이터로 변환해본다. ObjectMapper om = new Obje..
Jackson 라이브러리 ObjectMapper(readValue, writeValueAsString)ObjectMapper JSON 형태의 데이터를 String 또는 다른형태로 변환하거나 다른 타입의 json 데이터를 Json 타입의 데이터로 변환할 때 많이 사용한다. 1. Object => String @Getter @Setter public class User { int seq; String name; String number; public User(int seq, String name, String number){ this.seq = seq; this.name = name; this.number = number; } } 위와 같이 User 라는 Object 가 존재한다. 위 Object를 생성하면서 값을 지정하고 String 형 데이터로 변환해본다. ObjectMapper om = new Obje..
2022.09.21