如何使用 XML 通过 Spring Security Oauth2 启用 /oauth/check_token

2023-11-22

我已经使用 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>

请提出任何建议。一个有效的例子就太好了。

最好的 ./克里斯托弗


您需要创建一个类型的beanCheckTokenEndpoint (org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint).

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 XML 通过 Spring Security Oauth2 启用 /oauth/check_token 的相关文章

随机推荐