1
0
mirror of synced 2026-02-08 18:47:47 +08:00

支持外部自定义 Cache 缓存 state

This commit is contained in:
Yangkai.Shen
2019-08-02 15:03:09 +08:00
parent f921f55cc0
commit 1ea5001700
3 changed files with 39 additions and 28 deletions

View File

@@ -1,6 +1,9 @@
package com.xkcoding.justauth;
import com.xkcoding.justauth.properties.JustAuthProperties;
import me.zhyd.oauth.cache.AuthDefaultStateCache;
import me.zhyd.oauth.cache.AuthStateCache;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -20,8 +23,14 @@ public class JustAuthAutoConfiguration {
@Bean
@ConditionalOnProperty(prefix = "justauth", value = "enabled", havingValue = "true", matchIfMissing = true)
public AuthRequestFactory authRequestFactory(JustAuthProperties properties) {
return new AuthRequestFactory(properties);
public AuthRequestFactory authRequestFactory(JustAuthProperties properties, AuthStateCache authStateCache) {
return new AuthRequestFactory(properties, authStateCache);
}
@Bean
@ConditionalOnBean(AuthStateCache.class)
public AuthStateCache authStateCache() {
return AuthDefaultStateCache.INSTANCE;
}
}