보호 된 자원에 액세스하려면 oauth client_credential 부여 유형에 익숙해 지려고합니다 (이 자원 서버를 사용하고 있습니다 : https://bitbucket.org/hascode/spring-oauth2-example) 암시 적 흐름). 나의 이해에서 봄 부팅시 client_credential 부여 유형에서 보호 된 자원에 액세스
, client_credentials에는 사용자 정보이 없다, 그래서 일부 CONFIGS I가있는 경우 내가 그렇게, 또한 확실히 봄 초보자 아니에요 4012016-07-11 15:19:37.335 INFO 9747 --- [nio-9001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Getting user info from: http://rain.okta1.com:1802/oauth2/v1/userinfo
2016-07-11 15:19:37.421 INFO 9747 --- [nio-9001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Could not fetch user details: class org.springframework.web.client.HttpClientErrorException, 401 Unauthorized
을 반환하는 사용자 정보 엔드 포인트에 실패한 것 난 그냥 같은 사람에서 튜토리얼에 의해 진행되면서이 부여 유형에 대한 설정해야합니다 http://www.hascode.com/2016/03/setting-up-an-oauth2-authorization-server-and-resource-provider-with-spring-boot/ 많은 설정이 없었다
이 전체 자원
package com.hascode.tutorial;
import java.util.UUID;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Scope;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
@EnableResourceServer
public class SampleResourceApplication {
public static void main(String[] args) {
SpringApplication.run(SampleResourceApplication.class, args);
}
@RequestMapping("/")
public String securedCall() {
return "success (id: " + UUID.randomUUID().toString().toUpperCase() + ")";
}
}
입니다