스프링 프레임 워크로 개발중인 나머지 서비스에 OAuth를 추가하려고합니다. 저는 주석 기반 구성과 스프링 부트를 사용하여 실행 중입니다. oauth 토큰 엔드 포인트 용 비밀번호
나는 내 프로젝트에 다음과 같은 클래스가 :@Configuration
@EnableWebSecurity
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class SecuritySettings extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("admin").password("123").authorities("ROLE_USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated()
.and().httpBasic().and().csrf().disable();
}
}
다음과 같이 내 인증 서버 구성은 다음과 같습니다
@Configuration
@EnableAuthorizationServer
public static class MyAuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory().withClient("web")
.authorizedGrantTypes("password")
.authorities("ROLE_CLIENT","ROLE_TRUSTED_CLIENT","ROLE_USER")
.scopes("read", "write")
.resourceIds(RESOURCE_ID);
}
}
내가 할 때 나는에 요구하고 /oauth/token/
끝 지점에 GET 요청 HTTP 기본 자격 증명을 입력하십시오. 나는 admin
사용자로 로그인하려고하면 그 다음은 web
작품으로 사용자 이름을 입력
o.s.s.o.provider.endpoint.TokenEndpoint : Handling error: NoSuchClientException, No client with requested id: admin
기록됩니다,하지만 난 그것을 위해 암호를 알고하지 않습니다. 기본 암호가 기록되지만 작동하지 않습니다.
Using default security password: f23087f8-58ce-e3d-bc62-58bf0963e75c
그럼이 암호는 무엇입니까? 어디에서 찾을 수 있습니까? 어떻게 설정할 수 있습니까?
안녕하세요! 답장을 보내 주셔서 감사합니다. 당신이 옳습니다, 그것이 내가 여기서 성취하려고하는 것입니다. 나는 사용자 이름/암호 조합을 시도하기 위해서만 브라우저를 사용하고있었습니다. 나는 실제로 전에 링크 한 페이지를 읽었습니다. 문서의 예제 요청은'Authorization' 헤더를 보내므로 제 경우에는 Basic Encode64 (web : webclientsecret)와 같아야합니다. 나 맞아? 나는 아직도 그것을 작동시킬 수 없었다. – idursun
나는 마침내 작동하도록했습니다. 실제로 문제를 격리 할 수 있도록 요청한 내용에 실제로 답변했기 때문에 대답을 수락합니다. – idursun
Spring OAuth2에서 클라이언트 정의와 관련된 다른 문제를 조사하면서 답을 찾았습니다. 당신은 코멘트를 기꺼이합니까? 링크는 다음과 같습니다. http://stackoverflow.com/questions/36899386/null-client-in-oauth2-multi-factor-authentication – CodeMed