Add redis config
parent
4139796afe
commit
ce482add9c
|
@ -7,6 +7,7 @@ import com.monkeyk.sos.service.UserService;
|
||||||
import com.monkeyk.sos.web.oauth.OauthUserApprovalHandler;
|
import com.monkeyk.sos.web.oauth.OauthUserApprovalHandler;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
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.data.redis.connection.RedisConnectionFactory;
|
||||||
|
@ -131,6 +132,10 @@ public class OAuth2ServerConfiguration {
|
||||||
private AuthenticationManager authenticationManager;
|
private AuthenticationManager authenticationManager;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${spring.application.name:sos}")
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
||||||
|
|
||||||
|
@ -151,7 +156,9 @@ public class OAuth2ServerConfiguration {
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public TokenStore tokenStore(RedisConnectionFactory connectionFactory) {
|
public TokenStore tokenStore(RedisConnectionFactory connectionFactory) {
|
||||||
return new RedisTokenStore(connectionFactory);
|
final RedisTokenStore redisTokenStore = new RedisTokenStore(connectionFactory);
|
||||||
|
redisTokenStore.setPrefix(applicationName);
|
||||||
|
return redisTokenStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ spring.jmx.enabled=false
|
||||||
#
|
#
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
spring.redis.database=2
|
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
|
||||||
|
|
Loading…
Reference in New Issue