1. step 1
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
2. step 2,3,4,6
@Configuration
@EnableWebSecurity
public class WebSecurity extends WebSecurityConfigurerAdapter {
//권한과 관련된 작업업
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests().antMatchers("/users/**").permitAll();
http.headers().frameOptions().disable();
}
}
3. step 5
@SpringBootApplication
@EnableDiscoveryClient
public class UserServiceApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceApplication.class, args);
}
@Bean
public BCryptPasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
}
'MSA > MSA관련기술' 카테고리의 다른 글
도커 관련 정리 (도커 명령어 포함) (0) | 2022.10.05 |
---|---|
Spring Cloud Config 프로젝트 초기 세팅 (1) | 2022.10.04 |
Spring cloud gateway - eureka 연동 로드벨런싱 설정 (0) | 2022.07.05 |
Spring Cloud Gateway (api gateway) (0) | 2022.07.04 |
API Gateway Service (0) | 2022.07.04 |
댓글