본문 바로가기

728x90
반응형

Spring

(14)
[SpringBoot] yml, propertise 설정 값 암호화 (Jasypt) 🔒 Jasypt(Java Simplified Encryption)- 개발자가 암호화 작동 방식에 대한 깊은 지식이 없어도 최소한의 노력으로 프로젝트에 기본 암호화 기능을 추가할 수 있는 자바 라이브러리 - 프로퍼티로 관리하는 DB 계정 정보와 같은 설정 값을 평문이 아닌 암호문으로 관리 🐡 Jasypt Spring Stater 동작 방식@SpringBootApplication - 애플리케이션 구동 단계에서 ENC(암호화 된 값) 형식의 속성을 찾아 복호화 수행 후 복호화 된 값으로 원래의 암호화된 속성 값 대체 🧩 Jasypt 주요 메소드KeyRequiredDefault Valuejasypt.encryptor.passwordTrue-jasypt.encryptor.algorithmFalsePBEWITHHM..
[Spring Security] JWT Token 🔐 JWT : Json Web Token JWT는 세 부분으로 구성된다 : 헤더(Header), 페이로드(Payload), 서명(Signature). 헤더 (Header): 토큰의 유형 (즉, JWT)과 해싱 알고리즘 (예: HMAC SHA256 또는 RSA)을 정의하는 데 사용된다. 페이로드 (Payload): 페이로드는 클레임을 포함하고 있으며, 이는 엔티티 (일반적으로 사용자)와 추가 데이터에 대한 선언으로 클레임에는 등록된 (즉, 표준에 정의된), 공개, 비공개 클레임이 있다. 서명 (Signature): 헤더와 페이로드를 합친 후, 비밀키를 사용하여 이를 암호화한다. 이 서명은 토큰이 변조되지 않았음을 확인하는 데 사용되며, 비밀 키를 알고 있는 경우에만 토큰을 확인하거나 생성할 수 있다. 이 ..
[Spring] Service ServiceImpl 구조를 사용하는 것이 바람직한가 public interface MemberService{ Boolean singUp(); } public class Member implements MemberService { @Override public Boolean singUp() { return true; } } SpringMVC 구조로 개발 할 때 Service단을 Service, ServiceImpl 즉 인터페이스와 구현체로 구분하여 개발을 했었는데 오픈 소스를 분석하는 도중 Service단을 인터페이스-구현체 구조가 아닌 Service 클래스를 단일로 사용하는 구조가 많이 보였다. Spring Framework에서 Service와 ServiceImpl 구조를 사용하는 이유는 무엇일까? 1. 인터페이스와 구현 클래스를 분리할 수 있다. 이를 ..
[Spring Security] ajax login - Spring Security 를 이용하여 (ajax)비동기 로그인 구현하기 SecurityConfig.java @Configuration @EnableWebSecurity @Order(0) @Slf4j public class AjaxSecurityConfig extends WebSecurityConfigurerAdapter { private String[] permitAllResources = {"/api/public/**","/sample","/aws/**","/sample/**", "/login/**", "/outer/**", "/fonts/**", "/landing/**", "/error/**", "/aws/health/check"}; @Override public void configure(W..
[Spring Batch] 스프링 배치 주요 기능 및 스키마 생성 Spring Batch 소개 - 운영에 필수적인 강력한 배치 애플리케이션을 개발할 수 있도록 설계된 가렵고 포관적인 배치 프레임워크 - 로깅 및 추적, 트랜잭션 관리, 작업 처리 통계, 작업 재시작, 건너뛰기 및 리소스 관리를 포함하여 대량의 레코드를 처리하는 데 필수적인 재사용 가능한 기능을 제공 한다. 배치 핵심 패턴 Read - 데이터베이스, 파일, 큐에서 대량의 데이터를 조회 Process - 특정 방법으로 데이터를 가공 Write - 데이터를 수정된 양식으로 다시 저장 배치 주요 기능 - 배치 프로세스를 주기적으로 커밋 - 동시 다발적인 Job의 배치 처리, 대용량 병렬 처리 - 실패 후 수동 또는 스케쥴링에 의한 재시작 - 의존관계가 있는 step 여러 개를 순차적으로 처리 - 조건적 Flow..
[Spring Security] GET 로그아웃 처리 스프링 시큐리티의 로그아웃 기능은 별도의 설정을 하지 않으면 POST 방식을 지원한다. 이를 GET 방식으로 변경해주었다. tymeleaf를 사용한 get 로그아웃 처리 1. build.gradle dependency 추가 implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' 2. logout 기능을 구현할 .html 헤더 부분에 springsecurity name space 추가 3. 로그인 여부에 따라 보여진 태그 sec:authorize의 isAnonymous() / isAuthenticated() 로 구분 및 로그아웃 경로 설정 로그인 | 회원가입 회원명 | 로그아웃 isAnonymous() : 로그인하지 않은 사용자에게만 ..
[Spring Security] 스프링 시큐리티를 이용하여 로그인, 회원가입 구현하기 Config @Configuration @RequiredArgsConstructor public class SecurityConfig { private final AuthenticationSuccess authenticationSuccess; private final AuthenticationFailure authenticationFailure; private final LogoutExecute logoutExecute; private final LogoutSuccess logoutSuccess; private final UserDetailsService userDetailsService; private final AuthenticationEntryException authenticationEntryEx..
[Spring Secururity ERROR] 스프링 빈 순환 참조 에러 The dependencies of some of the beans i 스프링 시큐리티 설정 파일 세팅 중 비밀번호 암호화 설정을 위해 PasswordEncoder 반환 타입의 메소드를 선언 하는 중 순환 참조 오류가 발생하였다. Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true. 순환 참조에 의존하는 것은 권장되지 않으며 기본적..

728x90
반응형