我尝试启用outh / check_token,但遇到了一些困难 根据这个答案How to enable /oauth/check_token with Spring Security Oauth2 using XML
您需要创建一个CheckTokenEndpoint类型的bean。 我们如何做到这一点,我把它包含在我的spring security.xml
中<bean id="checkTokenEndpoint" class="org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint">
<constructor-arg name="resourceServerTokenServices" ref="tokenServices"/>
</bean>
此类org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint
正在抛出错误
Multiple annotations found at this line:
- Class 'org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint' not found
- Class 'org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint' not found [config set: AuthenticationApp/web-
context]
这就是全部
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd ">
有人可以帮助所有示例使用spring boot和java config但我必须使用xml config
答案 0 :(得分:0)
使用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>