minlog
article thumbnail
[ Security ] 01. 시큐리티 사용하기 - WebSecurityConfigurerAdapter 권한 설정 (스프링 부트 버전 2.7.0이전)
BackEnd/Security · JPA 2023. 5. 23. 13:22

시큐리티 설정 파일 - WebSecurityConfigurerAdapter 1. Security 권한 설정 Security의 권한은 config에서 설정해줄수 있다. 스프링 부트 버전 2.7.0 이전에는 ' WebSecurityConfigurerAdapter ' 를 상속받아서 할 수 있다. 1) WebSecurityConfigurerAdapter를 상속 받는 클래스 생성. WebSecurityConfigurerAdapter : SecurityFilterChain 필터 체인은 반드시 하나 이상이고 url 패턴에 따라 적용되는 필터 체인을 다르게 할 수 있다. 본래의 메인 필터를 반드시 통과해야만 서블릿에 들어갈 수 있는 단점을 보완 하기위해서 필터 체인 proxy를 두었다고 할수 있다. web resour..

article thumbnail
[ Security ] 01. 시큐리티 사용하기 - 설정 파일
BackEnd/Security · JPA 2023. 5. 3. 20:05

시큐리티 설정 파일 시큐리티와 관련된 모든 설정들을 관리하는 config 클래스 이다. 스프링 부트 버전 2.7.0 이전에는 ' WebSecurityConfigurerAdapter ' 를 상속( * 페이지 이동 )받아서 사용해야하며, 이후 부터는 사용되지 않으므로 주의 해야한다. 📑SecurityConfig.java package com.example.springsecurity.config; import lombok.extern.log4j.Log4j2; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.configuration.WebSecuri..

article thumbnail
[ JPA ] 동적 쿼리 처리를 해주는 Querydsl 사용해보기
BackEnd/Security · JPA 2023. 4. 16. 00:15

Querydsl JPA 기본 쿼리 메서드의 기능과 @Query 어노테이션만으로 어려운 복잡한 검색 조건을 동적으로 쿼리를 생성해서 처리할 수 있는 기술이다. Querydsl 사용해보기 1. 빌드 추가 라이브러리를 사용하기 위해서 build.gradle 파일에 내용을 추가해주어야 한다. 📑 build.gradle // 1. querydsl 추가 buildscript { ext { queryDslVersion = "5.0.0" } } plugins { id 'org.springframework.boot' version '2.7.10' id 'io.spring.dependency-management' version '1.0.15.RELEASE' //2. querydsl 추가 id "com.ewerk.gradl..

article thumbnail
[ Security ] 시큐리티 - 로그인
BackEnd/Security · JPA 2023. 4. 4. 14:52

Security 로그인 스프링 프레임워크에서 로그인을 한다는 것은 authenticated 가 true인 Authentication 객체를 SecurityContext 에 갖고 있는 상태를 말합니다. 단 Authentication이 AnonymousAuthenticationToken ( 다른 사용자 )만 아니면 됩니다. Authentication (인증)의 기본 구조 인증 토큰 (Authentication)을 제공하는 필터들 UsernamePasswordAuthenticationFilter 폼 로그인 (아이디/패스워드 로그) RememberMeAuthenticationFilter 자동로그인이 선택 되어있다면, 쿠키 로그인 AnonymousAuthenticationFilter 로그인 인증이 되어있지 않았다..

article thumbnail
[ JPA ] Embedded - 재활용 가능한 Entity
BackEnd/Security · JPA 2023. 4. 2. 13:06

Embeddable 반복된 코드는 Embedded JAVA클래스로 따로 생성 해준다. JPA 테이블 생성시 Entity 객체의 필드로 포함이 되는 것을 확인 할 수 있다. 근로기간, 전화번호, 주소 같은 내용들을 Embeddable로 사용할 수 있다. ex) 회원정보 테이블과 회원정보 히스토리 테이블 1. 공통 된 코드 ( Embeddable) 객체 생성. @Embeddable - entity 내부에 선언 할수 있게됨 📑 Address.java @Data @AllArgsConstructor @NoArgsConstructorE @Embeddable public class Address{ private String city; //시 private String district; //구 @Column(name=..