我已经使用
spring-security 3.2.*和
javaconfig成功启用了’/ oauth / check_token’端点,但是目前我只限于spring-security 3.1.4,然后我坚持使用
XML配置. ‘/ oauth / token’端点正在按照我的意愿工作,但是我无法启用check_token端点,我找不到任何(非javaconfig)文档来解释要做什么.
Vanila授权服务器配置:
<oauth:authorization-server client-details-service-ref="client-service" token-services-ref="tokenServices" > <oauth:refresh-token disabled="false" /> <oauth:client-credentials disabled="false" /> <oauth:password authentication-manager-ref="userAuthenticationManager" /> </oauth:authorization-server>
http安全配置:
<sec:http auto-config="true" pattern="/oauth/token" create-session="stateless" authentication-manager-ref="clientAuthenticationManager"> <sec:intercept-url pattern="/oauth/token" access="IS_AUTHENTICATED_FULLY" /> <sec:anonymous enabled="false"/> <sec:http-basic entry-point-ref="clientAuthenticationEntryPoint" /> </sec:http>
我试图添加以下http配置但没有成功.
<sec:http auto-config="true" pattern="/oauth/check_token" create-session="stateless" authentication-manager-ref="clientAuthenticationManager"> <sec:intercept-url pattern="/oauth/check_token" access="IS_AUTHENTICATED_FULLY" /> <sec:anonymous enabled="false"/> <sec:http-basic entry-point-ref="clientAuthenticationEntryPoint" /> </sec:http>
拜托,任何建议.一个工作的例子会很棒.
最好
./Kristofer
解决方法
使用spring oauth2的最新版本:
<dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>2.0.10.RELEASE</version> </dependency>
确保spring security oauth文件配置中正在使用的正确版本的xsd:
http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
在元素authorization-server中插入选项check-token-enabled =“true”:
<oauth:authorization-server ... check-token-enabled="true"> ... </oauth:authorization-server>