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>
<!--Redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
<!--</dependency>-->
<dependency>
<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.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
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.request.DefaultOAuth2RequestFactory;
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;
@ -140,21 +139,21 @@ public class OAuth2ServerConfiguration {
/*
* JDBC TokenStore
*/
// @Bean
// public TokenStore tokenStore(DataSource dataSource) {
// return new JdbcTokenStore(dataSource);
// }
@Bean
public TokenStore tokenStore(DataSource dataSource) {
return new JdbcTokenStore(dataSource);
}
/*
* Redis TokenStore
*/
@Bean
public TokenStore tokenStore(RedisConnectionFactory connectionFactory) {
final RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory);
//prefix
redisTokenStore.setPrefix(RESOURCE_ID);
return redisTokenStore;
}
// @Bean
// public TokenStore tokenStore(RedisConnectionFactory connectionFactory) {
// final RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory);
// //prefix
// redisTokenStore.setPrefix(RESOURCE_ID);
// return redisTokenStore;
// }
@Bean

View File

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