繁体   English   中英

使用Xml的Spring Security oauth2 check_token

[英]spring security oauth2 check_token using Xml

我正在尝试使用启用outh / check_token,但根据此答案有一些困难如何使用XML使用Spring Security Oauth2启用/ oauth / check_token

您需要创建一个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

使用spring oauth2的最新版本:

<dependency>
<groupId>org.springframework.security.oauth</groupId
<artifactId>spring-security-oauth2</artifactId
<version>2.0.10.RELEASE</version>
</dependency>

确保在春季安全性oauth文件配置中使用的是正确版本的xsd:

http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd

将选项check-token-enabled =“ true”插入到元素授权服务器中:

<oauth:authorization-server ... check-token-enabled="true">
... 
</oauth:authorization-server>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM