spring security 기본설정

spring security 기본설정

728x90

@EnableWebSecurity, WebSecurityConfigurerAdapter 등록 필수!!

package io.security.basicsecurity; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // 어떠한 요청에도 인증 받게 http .authorizeRequests() .anyRequest().authenticated(); // 인증 방법은 form 로그인 방식으로 http .formLogin(); } }

application.properties

기본 id,password 등록

spring.security.user.name=user spring.security.user.password=1111

728x90

from http://arch1tect.tistory.com/220 by ccl(A) rewrite - 2021-11-29 17:01:24