简体   繁体   中英

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). 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.

I guess I have to implement my own OAuthProviderTokenServices but I'm not sure. 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. Take a look at JdbcOAuth2ProviderTokenServices for code to borrow, especially around serializing the Authentication object.

I implemented a custom JPA backed OAuth2ProviderTokenServices in a similar way and it was pretty easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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