Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring OAuth2客户端_凭据与预验证的用户_Java_Spring Mvc_Spring Security_Spring Boot_Spring Security Oauth2 - Fatal编程技术网

Java Spring OAuth2客户端_凭据与预验证的用户

Java Spring OAuth2客户端_凭据与预验证的用户,java,spring-mvc,spring-security,spring-boot,spring-security-oauth2,Java,Spring Mvc,Spring Security,Spring Boot,Spring Security Oauth2,我的应用程序使用 我想使用ClientCredentialsResourceDetails(签名获取)使用OAuth2保护的资源 当将其与预验证的UserDetails结合使用时,spring不会存储OAuth令牌: DEBUG o.s.s.w.a.AnonymousAuthenticationFilter - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.sprin

我的应用程序使用

我想使用
ClientCredentialsResourceDetails
(签名获取)使用OAuth2保护的资源

当将其与预验证的
UserDetails
结合使用时,spring不会存储OAuth令牌:

DEBUG o.s.s.w.a.AnonymousAuthenticationFilter - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken@4662f11e: Principal: User = ***

如何使其工作?

令牌存储在
OAuth2RestTemplate
中的内存中。这对于大多数用例来说已经足够好了,因为您可以将它设置为一个单例bean(每个客户端一个)。

对不起,我还不明白这个问题。如果您已通过容器预验证,那么为什么需要OAuth2,以及您希望令牌存储在何处?我想使用一个使用OAuth2和客户端凭据的api。为了节省时间,最好存储下一个请求的令牌?