org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore Java Examples
The following examples show how to use
org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuth2AuthorizationServerConfig.java From oauth-boot with MIT License | 6 votes |
@Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints // token 存储方式 .tokenStore(tokenStore) .authenticationManager(authenticationManager) // 不配置会导致token无法刷新 .userDetailsService(userDetailsService) .allowedTokenEndpointRequestMethods(HttpMethod.POST,HttpMethod.GET); // 判断当前是否使用jwt if(!(tokenStore instanceof RedisTokenStore) && this.converter!=null){ endpoints.accessTokenConverter(converter); } // 处理 ExceptionTranslationFilter 抛出的异常 endpoints.exceptionTranslator(bootWebResponseExceptionTranslator); endpoints.pathMapping("/oauth/confirm_access","/custom/confirm_access"); }
Example #2
Source File: ResourceServerConfig.java From lion with Apache License 2.0 | 5 votes |
@Override public void configure(ResourceServerSecurityConfigurer resources) throws Exception { resources /** * redis 存储有状态方式 */ .tokenStore(new RedisTokenStore(redisConnectionFactory)) /** * jwt 无状态方式 */ //.tokenStore(new JwtTokenStore(accessTokenConverter())); //.authenticationEntryPoint((request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED)) .authenticationEntryPoint(new CustomAuthenticationEntryPoint()) .accessDeniedHandler(new CustomAccessDeniedHandler()); }
Example #3
Source File: SophiaAuthorizationServerConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
/** * token store */ @Bean public TokenStore tokenStore() { RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory); redisTokenStore.setPrefix(GlobalsConstants.PROJECT_PREFIX+ GlobalsConstants.OAUTH_PREFIX); return redisTokenStore; // return new JwtTokenStore(accessTokenConverter()); }
Example #4
Source File: SophiaResourceServerConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
/** * token store */ @Bean public TokenStore tokenStore() { // return new InMemoryTokenStore(); RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory); redisTokenStore.setPrefix(GlobalsConstants.PROJECT_PREFIX+GlobalsConstants.OAUTH_PREFIX); return redisTokenStore; // return new JwtTokenStore(jwtAccessTokenConverter()); // return new JdbcTokenStore(dataSource); }
Example #5
Source File: SophiaResourceServerConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
/** * token store */ @Bean public TokenStore tokenStore() { // return new InMemoryTokenStore(); RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory); redisTokenStore.setPrefix(GlobalsConstants.PROJECT_PREFIX+GlobalsConstants.OAUTH_PREFIX); return redisTokenStore; // return new JwtTokenStore(jwtAccessTokenConverter()); // return new JdbcTokenStore(dataSource); }
Example #6
Source File: SophiaResourceServerConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
/** * token store */ @Bean public TokenStore tokenStore() { // return new InMemoryTokenStore(); return new RedisTokenStore(redisConnectionFactory); // return new JwtTokenStore(jwtAccessTokenConverter()); // return new JdbcTokenStore(dataSource); }
Example #7
Source File: SophiaAuthorizationServerConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
/** * token store */ @Bean public TokenStore tokenStore() { RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory); redisTokenStore.setPrefix(GlobalsConstants.PROJECT_PREFIX+GlobalsConstants.OAUTH_PREFIX); return redisTokenStore; // return new JwtTokenStore(accessTokenConverter()); }
Example #8
Source File: AuthorizationServerConfiguration.java From cola-cloud with MIT License | 5 votes |
@Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) { endpoints .tokenStore(new RedisTokenStore(redisConnectionFactory)) // .accessTokenConverter(jwtAccessTokenConverter()) .authenticationManager(authenticationManager) .exceptionTranslator(webResponseExceptionTranslator) .reuseRefreshTokens(false) .userDetailsService(integrationUserDetailsService); }
Example #9
Source File: FwAuthorizationConfiguration.java From fw-cloud-framework with MIT License | 5 votes |
/** * tokenstore 定制化处理 1. 如果使用的 redis-cluster 模式请使用 FwRedisTokenStore FwRedisTokenStore tokenStore = new * FwRedisTokenStore(); * tokenStore.setRedisTemplate(redisTemplate); */ @Bean public TokenStore redisTokenStore() { RedisTokenStore tokenStore = new RedisTokenStore(redisConnectionFactory); tokenStore.setPrefix(SecurityConstant.PREFIX); return tokenStore; }
Example #10
Source File: OpenHelper.java From open-cloud with MIT License | 5 votes |
/** * 构建资源服务器RedisToken服务类 * * @return */ public static ResourceServerTokenServices buildRedisTokenServices(RedisConnectionFactory redisConnectionFactory) throws Exception { OpenRedisTokenService tokenServices = new OpenRedisTokenService(); // 这里的签名key 保持和认证中心一致 RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory); tokenServices.setTokenStore(redisTokenStore); log.info("buildRedisTokenServices[{}]", tokenServices); return tokenServices; }
Example #11
Source File: AuthorizationServerConfig.java From lion with Apache License 2.0 | 5 votes |
@Bean public TokenStore tokenStore() { /** * redis 存储有状态方式 */ return new RedisTokenStore(redisConnectionFactory); /** * jwt 无状态方式 */ //return new JwtTokenStore(jwtAccessTokenConverter()); }
Example #12
Source File: AuthorizationServerConfig.java From cloud-service with MIT License | 5 votes |
/** * 令牌存储 */ @Bean public TokenStore tokenStore() { if (storeWithJwt) { return new JwtTokenStore(accessTokenConverter()); } RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory); // 解决同一username每次登陆access_token都相同的问题 redisTokenStore.setAuthenticationKeyGenerator(new RandomAuthenticationKeyGenerator()); return redisTokenStore; }
Example #13
Source File: FebsAuthorizationServerConfigure.java From FEBS-Cloud with Apache License 2.0 | 5 votes |
@Bean public TokenStore tokenStore() { if (properties.getEnableJwt()) { return new JwtTokenStore(jwtAccessTokenConverter()); } else { RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory); // 解决每次生成的 token都一样的问题 redisTokenStore.setAuthenticationKeyGenerator(oAuth2Authentication -> UUID.randomUUID().toString()); return redisTokenStore; } }
Example #14
Source File: AuthorizationServerConfig.java From spring-boot-demo with MIT License | 5 votes |
/** * 认证服务端点配置 */ @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) { endpoints //用户管理 .userDetailsService(userDetailsService) //token存到redis .tokenStore(new RedisTokenStore(redisConnectionFactory)) //启用oauth2管理 .authenticationManager(authenticationManager) //接收GET和POST .allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST); }
Example #15
Source File: OAuth2ResourceServer.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(connectionFactory); }
Example #16
Source File: SophiaAuthorizationServerConfig.java From sophia_scaffolding with Apache License 2.0 | 4 votes |
/** * token store */ @Bean public TokenStore tokenStore() { return new RedisTokenStore(connectionFactory); }
Example #17
Source File: OAuth2AuthorizationServer.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(connectionFactory); }
Example #18
Source File: OAuth2AuthorizationServer.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { RedisTokenStore redis = new RedisTokenStore(connectionFactory); return redis; }
Example #19
Source File: OAuth2SecurityConfiguration.java From spring-cloud-shop with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #20
Source File: OAuth2ResourceServerConfiguration.java From spring-cloud-shop with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #21
Source File: AuthorizationServerConfig.java From springboot-seed with MIT License | 4 votes |
@Bean public TokenStore getTokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #22
Source File: AuthServerConfig.java From docs-manage with MIT License | 4 votes |
@Bean public RedisTokenStore tokenStore() { return new RedisTokenStore(connectionFactory); }
Example #23
Source File: OAuth2AuthorizationServerConfig.java From xxproject with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #24
Source File: Oauth2TokenStoreConfiguration.java From onetwo with Apache License 2.0 | 4 votes |
@Bean public TokenStore redisTokenStore(@Autowired RedisConnectionFactory redisConnectionFactory){ RedisTokenStore store = new RedisTokenStore(redisConnectionFactory); return store; }
Example #25
Source File: CustomTokenStore.java From spring-microservice-boilerplate with MIT License | 4 votes |
private RedisTokenStore redisTokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #26
Source File: AuthorizationServerConfiguration.java From cola with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(redisConnectionFactory); }
Example #27
Source File: AuthorizationServerConfiguration.java From MyShopPlus with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore() { // 基于 JDBC 实现,令牌保存到数据库 // return new JdbcTokenStore(dataSource()); return new RedisTokenStore(redisConnectionFactory); }
Example #28
Source File: RedisTokenStoreConfig.java From spring-cloud-study with Apache License 2.0 | 4 votes |
@Bean public TokenStore redisTokenStore (){ return new RedisTokenStore(redisConnectionFactory); }
Example #29
Source File: RedisTokenStoreConfig.java From spring-cloud-study with Apache License 2.0 | 4 votes |
@Bean public TokenStore redisTokenStore (){ return new RedisTokenStore(redisConnectionFactory); }
Example #30
Source File: ResourceServerConfiguration.java From spring-security with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore(){ return new RedisTokenStore(redisConnectionFactory); }