![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/Kpuyk/btq4Ed8UqKY/MTMmf398dZWtSBnXk6ahXK/img.png)
PasswordEncoder 설정하기 기존의 {noop} 문자열을 더해줘서 Password encoding 하던 것을 Spring Security가 지원해주는 PasswordEncoder를 사용해보겠습니다. Bean 등록 Application.java @SpringBootApplication public class Application { @Bean public PasswordEncoder passwordEncoder() { return NoOpPasswordEncoder.getInstance(); } // 1 public static void main(String[] args) { SpringApplication.run(Application.class, args); } } PasswordEncoder를..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/wWzes/btq4z0JNZRU/4cga2t9RQ58aIfgh34WuTk/img.png)
JPA와 Security 연동 이전의 문제점 매번 유저를 추가하는 일이 생길 경우 코드를 수정해야 한다. 수정, 삭제도 마찬가지로 코드를 수정해야 한다. -> 위와 같은 문제를 DB를 연동하여 유저 정보를 관리할 수 있도록 수정해보겠습니다. (JPA를 사용하겠습니다.) 개선 JPA 설정 dependency 추가 build.gradle dependencies { ... // JPA implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // H2 runtimeOnly 'com.h2database:h2' ... } class 생성 Account @Entity @Getter @Setter public class Account { @Id @..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/7Li91/btq4F6aA3Z7/BptP1zDqNuKd6ZLqOeZfW0/img.png)
Inmemory User 현재 기본으로 생성되는 유저와 패스워드 log를 확인해보면 UserDeatilsServiceAutoConfiguration에서 찍히는걸 확인할 수 있습니다. UserDetailsServiceAutoConfiguration.java User 정보는 SecurityProperties에서 가져오며 name, password, role을 설정 할 수 있습니다. yml 수정하여 기본 생성되는 유저 정보 변경하기 http://localhost:8080/login 에 접속하여 properties에 작성한 ID, Password를 입력해주면 기존처럼 접속이 가능합니다.. 문제점 유저 정보가 1개밖에 없다. 소스를 보면 어떤 유저정보가 있는지 확인할 수 있다. -> 그러므로 유저정보를 prope..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/MzDJs/btq4AsTjUCj/lvAlnaZb3tiBsnPks6bTjK/img.png)
Spring Security Dependency build.gradle dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' } 인증 가능 사용자 정보 알 수 있다. Security Setting SecurityConfig.java @Configuration @EnableWebSecurity @RequiredArgsConstructor public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authoriz..
- Total
- Today
- Yesterday
- 스프링부트
- Security
- Python
- java11
- 자바
- howtoinstallnginx
- Java
- ControllerAdvice
- API
- Spring
- FastAPI
- ResourceHttpReqeustHandler
- springsecurity
- 스프링시큐리티
- mapstruct
- 웹서비스
- ubuntu
- 유사결과
- booleanExpression
- JPA
- like절
- 개발
- paawordencoder
- 스프링부트 시작하기
- QueryDSL
- springboot
- @formula
- boot
- spring web
- 스프링
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |