@Autowired
private RedisConnectionFactory redisConnectionFactory;
/**
     * 用来定义授权与管理token
     * @param endpoints
     * @throws Exception
     */
    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        log.warn("configure AuthorizationServerEndpointsConfigurer");
        log.warn("tokenServices " + authorizationServerTokenServices);
        jwtAccessTokenConverter.setSigningKey("uwo");
        endpoints
            .tokenEnhancer(jwtTokenEnhancer())
            .accessTokenConverter(jwtTokenEnhancer())
            // 持久操作
            .tokenStore(new RedisTokenStore(redisConnectionFactory))
            //.tokenStore(new JwtTokenStore(jwtTokenEnhancer()))
            .authenticationManager(authenticationManager)
            .userDetailsService(userDetailsService)
        ;
    }
@Autowired
private RedisConnectionFactory redisConnectionFactory;
@Override
    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
        resources
            .resourceId(RESOURCE_ID)
            .tokenServices(defaultTokenServices());
    }
    @Bean
    public ResourceServerTokenServices defaultTokenServices() {
        final DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
        defaultTokenServices.setTokenEnhancer(jwtTokenEnhancer());
        defaultTokenServices.setTokenStore(new RedisTokenStore(redisConnectionFactory));
//        defaultTokenServices.setTokenStore(new JwtTokenStore(jwtTokenEnhancer()));
        return defaultTokenServices;
    }
    @Bean
    protected JwtAccessTokenConverter jwtTokenEnhancer() {
        OssJwtAccessTokenConverter converter = new OssJwtAccessTokenConverter();
        converter.setSigningKey("uwo");
        return converter;
    }