Comment redis support config

2.0.1
monkeyk7 2019-07-05 00:07:02 +08:00
parent 077f1965e6
commit ce5e7f93be
3 changed files with 20 additions and 21 deletions

View File

@ -67,10 +67,10 @@
</dependency> </dependency>
<!--Redis--> <!--Redis-->
<dependency> <!--<dependency>-->
<groupId>org.springframework.boot</groupId> <!--<groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-starter-data-redis</artifactId> <!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
</dependency> <!--</dependency>-->
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>

View File

@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.config.http.SessionCreationPolicy;
@ -28,7 +27,7 @@ import org.springframework.security.oauth2.provider.code.AuthorizationCodeServic
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices; import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory; import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore; import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -140,21 +139,21 @@ public class OAuth2ServerConfiguration {
/* /*
* JDBC TokenStore * JDBC TokenStore
*/ */
// @Bean @Bean
// public TokenStore tokenStore(DataSource dataSource) { public TokenStore tokenStore(DataSource dataSource) {
// return new JdbcTokenStore(dataSource); return new JdbcTokenStore(dataSource);
// } }
/* /*
* Redis TokenStore * Redis TokenStore
*/ */
@Bean // @Bean
public TokenStore tokenStore(RedisConnectionFactory connectionFactory) { // public TokenStore tokenStore(RedisConnectionFactory connectionFactory) {
final RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory); // final RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory);
//prefix // //prefix
redisTokenStore.setPrefix(RESOURCE_ID); // redisTokenStore.setPrefix(RESOURCE_ID);
return redisTokenStore; // return redisTokenStore;
} // }
@Bean @Bean

View File

@ -32,10 +32,10 @@ spring.jmx.enabled=false
# #
# Redis # Redis
# #
spring.redis.host=localhost #spring.redis.host=localhost
spring.redis.port=6379 #spring.redis.port=6379
spring.redis.database=0 #spring.redis.database=0
spring.redis.password= #spring.redis.password=
#spring.redis.timeout=2000 #spring.redis.timeout=2000
#spring.redis.ssl=false #spring.redis.ssl=false