매우 다양한 방법이 있다. 그 중 간단한 방법을 사용해 보자.
password가 생성되는 클래스를 보면 힌트를 얻을 수 있다.
spring.security.user.name=admin
spring.security.user.password=1234
spring.security.user.roles=ADMIN
콘솔에 패스워드가 출력되지 않는다.
시큐리티 설정
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("cmlee").password("{noop}123").roles("USER").and()
.withUser("admin").password("{noop}!@#").roles("ADMIN");
}
{noop}
은 스프링 시큐리티 5.x 부터 지원되는 기본 패스워드 인코더를 명시하는 부분이다.{noop}
은 암호화를 하지 않았다는 뜻이다.굿!!