spring-authorization-server
spring-authorization-server copied to clipboard
How-to: Implement core services with JSON-backed store
We should provide a guide that demonstrates how to implement RegisteredClientRepository
, OAuth2AuthorizationService
and OAuth2AuthorizationConsentService
using a JSON-backed store (e.g. Redis).
Related gh-558
Is there an implementation for Redis now
I saw a Redis implementation here before, but now it's gone
I'm waiting.
I guess this could be used with MongoDb aswell, looking forward!
I tried implementing a RedisOAuth2AuthorizationService: https://github.com/wapkch/spring-authorization-server-demo/blob/main/src/main/java/sample/redis/RedisOAuth2AuthorizationService.java
I tried implementing a RedisOAuth2AuthorizationService: https://github.com/wapkch/spring-authorization-server-demo/blob/main/src/main/java/sample/redis/RedisOAuth2AuthorizationService.java
Out of curiosity, is your proposal functional?
Tks
I implemented a RedisOAuth2AuthorizationService
based on redis storage in a jpa-like way
GitHub:https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java
Gitee:https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java
In the future, I will try to use the same method to implement RegisteredClientRepository
and OAuth2AuthorizationConsentService
.
Sorry, didn't have time to implement it until now, have now added Redis based RegisteredClientRepository
and OAuth2AuthorizationConsentService
implementation using the same way (similar to Jpa)
RedisRegisteredClientRepository: Github: https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/repository/RedisRegisteredClientRepository.java Gitee: https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/repository/RedisRegisteredClientRepository.java
RedisOAuth2AuthorizationConsentService: Github: https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationConsentService.java Gitee: https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationConsentService.java
I implemented a based on redis storage in a jpa-like way GitHub:https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java Gitee:https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java
RedisOAuth2AuthorizationService
In the future, I will try to use the same method to implement and .
RegisteredClientRepository``OAuth2AuthorizationConsentService
How-to: Handle the expiration of the Secondary Index
I implemented a based on redis storage in a jpa-like way GitHub:https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java Gitee:https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java
RedisOAuth2AuthorizationService
In the future, I will try to use the same method to implement and .RegisteredClientRepository
OAuth2AuthorizationConsentService ``How-to: Handle the expiration of the Secondary Index
There is currently no good solution. One stupid way is to manually set the expiration time of the Secondary Index.
I implemented a based on redis storage in a jpa-like way GitHub:https://github.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java Gitee:https://gitee.com/vains-Sofia/authorization-example/blob/master/authorization-server/src/main/java/com/example/service/impl/RedisOAuth2AuthorizationService.java
RedisOAuth2AuthorizationService
In the future, I will try to use the same method to implement and .RegisteredClientRepository
OAuth2AuthorizationConsentService ``How-to: Handle the expiration of the Secondary Index
Problem solved;
Add annotation on SpringBean: @EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
, as shown below: Gitee,Github