简体   繁体   English

使用Spring Security 3在我的Grails OAuth提供程序上存储访问令牌

[英]Store access token on my Grails OAuth provider using Spring Security 3

I've just implemented a oAuth provider for my Grails application, and can sucessfully authenticate my client application (using signpost). 我刚刚为我的Grails应用程序实现了oAuth提供程序,并且可以成功验证我的客户端应用程序(使用路标)。 The next thing I want to do is persist the access token, so my client doesn't have to accept permission everytime. 我要做的下一件事是保持访问令牌,所以我的客户端不必每次都接受权限。 On the server I use the Spring Security OAuth package. 在服务器上,我使用Spring Security OAuth包。

I guess I have to implement my own OAuthProviderTokenServices but I'm not sure. 我想我必须实现自己的OAuthProviderTokenServices,但我不确定。 Is there any out-of-the-box handler that I can use, or what is the way to go? 我可以使用任何开箱即用的处理程序,或者是什么方式去?

Thanx!! 感谢名单!

There is an out of the box provider for OAuth2 (JdbcOAuth2ProviderTokenServices) but it looks like there is not a comparable class for OAuth 1. Your best bet would be to subclass RandomValueProviderTokenServices and implement the three abstract persistence related methods. OAuth2(JdbcOAuth2ProviderTokenServices)有一个开箱即用的提供程序,但看起来OAuth 1没有类似的类。您最好的选择是子类RandomValueProviderTokenServices并实现三个抽象持久性相关方法。 Take a look at JdbcOAuth2ProviderTokenServices for code to borrow, especially around serializing the Authentication object. 查看JdbcOAuth2ProviderTokenServices以获取要借用的代码,尤其是在序列化Authentication对象时。

I implemented a custom JPA backed OAuth2ProviderTokenServices in a similar way and it was pretty easy. 我以类似的方式实现了一个自定义JPA支持的OAuth2ProviderTokenServices,它非常简单。

暂无
暂无

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

相关问题 使用带有OpenID Connect提供程序的spring-security-oauth2客户端时,如何访问“id_token”和“refresh_token”? - How to access the “id_token” and “refresh_token” when using spring-security-oauth2 client with OpenID Connect provider? Spring Security + OAuth,如果缺少访问令牌,则进行回退 - Spring Security + OAuth, fallback if access token absent org.springframework.security.oauth2.provider.token.store.MongoDBTokenStore - org.springframework.security.oauth2.provider.token.store.MongoDBTokenStore Spring security oauth2 - 无法访问 /oauth/token 路由 - Spring security oauth2 - Can't access /oauth/token route 如何使用 Spring Security 5 在 Spring Boot 应用程序(不是 Web 应用程序)中获取 oauth2 访问令牌 - How to get oauth2 access token in a spring boot application (not a web application) using spring security 5 Spring Security Oauth 2。 在服务器端存储refresh_token - Spring Security Oauth2. Store refresh_token on server side 使用Spring Security(非OAuth)使用登录名,密码和Facebook访问令牌的身份验证方法 - Authentication methods using login, password and Facebook access token using Spring Security(not OAuth) Spring OAuth2 - 在令牌存储中手动创建访问令牌 - Spring OAuth2 - Manually creating an access token in the token store Spring Boot 2.0.3 Oauth2安全性:即使在标头中使用访问令牌也会出现401错误 - Spring Boot 2.0.3 Oauth2 Security: Getting 401 error even when using access token in header Spring OAuth2.0:spring存储访问令牌的位置是什么? - Spring OAuth2.0: Where does spring store the access token?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM