oauth2 spring-authorization-server OAuth2AuthorizationService支持redis

授权服务器版本:0.2.0-0.3.1

OAuth2AuthorizationService官方目前实现了InMemoryOAuth2AuthorizationService和JdbcOAuth2AuthorizationService,在微服务场景下,需要使用redis存储认证对象,官方未提供redis的相关实现,分析官方内部实现逻辑,有hasToken部分代码实现不太合理,导致重写支持Redis的Service时,要参照InMemoryOAuth2AuthorizationService中部分逻辑
public final class OAuth2AuthorizationTokenVisitor {

    @Getter
    private final OAuth2Authorization oAuth2Authorization;

    private OAuth2AuthorizationTokenVisitor(OAuth2Authorization oAuth2Authorization) {
        this.oAuth2Authorization = oAuth2Authorization;
    }

    public static OAuth2AuthorizationTokenVisitor of(OAuth2Authorization oAuth2Authorization) {
        return new OAuth2AuthorizationTokenVisitor(oAuth2Authorization);
    }
    
    /**
     * 获取访问token
     * @return 访问token
     */
    public Optional> accessToken() {
        return Optional.ofNullable(oAut

你可能感兴趣的:(SpringBoot,Security,OAuth2,redis,oauth2,spring,boot,spring,security)