나는 데이브 Syer에서 기본 봄 부팅으로 OAuth2 다음 예제있어 기본 이외의 암호를 부여 자격 증명을 사용하여 얻을 수 있습니다 그러나 권한 부여는 스프링 부트 기본 보안 사용자 (시작할 때 "기본 보안 암호 사용 : 927ca0a0-634a-4671-bd1c-1323a866618a"가 출력 됨)를 사용합니다.어떻게 봄 부팅 및 OAuth2를 예제
제 질문은 어떻게 기본 사용자 계정을 대체하고 실제로 WebSecurityConfig에 의존합니까?
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
protected static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder)
throws Exception {
authManagerBuilder.inMemoryAuthentication().withUser("user")
.password("password").roles("USER");
}
}
그러나 설명서에 제시된대로 기본 Spring 사용자/암호를 덮어 쓰는 것처럼 보이지는 않습니다.
이 기능을 사용하려면 무엇이 누락 되었습니까? 나는 2.0.3에 여전히 해요으로
이 아니 당신이 그것을'@Order (SecurityProperties.ACCESS_OVERRIDE_ORDER)를'추가하지 말아야하지 않는 한 - 또한 위의 문제 문에 대한 좋은 참고를 발견했다. 'security.user.name'과'security.user.password' 속성을 설정하여 application.properties 파일에서 기본 사용자 이름/암호를 설정할 수 있습니다. 더 많은 속성에 대해서는 [참조 설명서] (http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html)를 참조하십시오. –
더 나은 샘플이 있습니다. (최신 버전은 https://github.com/spring-projects/spring-security-oauth/blob/master/tests/annotation/jdbc/src/main/java/demo/Application입니다.) .java # L81. 그'authenticationManager' 메소드는 2.0.4 스냅 샷에서 새로운 오버 라이드입니다 (2.0.3에서 사용하고자한다면 구현을보십시오). –
@DaveSyer 샘플이 실행되지 않았습니다. "org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration '" –