@@ -17,9 +17,11 @@ public class AuthenticationConfig extends AbstractConfig implements IsStroomConf
17
17
public static final String PROP_NAME_OPENID = "openId" ;
18
18
public static final String PROP_NAME_PREVENT_LOGIN = "preventLogin" ;
19
19
public static final String PROP_NAME_API_KEY_CACHE = "apiKeyCache" ;
20
+ public static final String PROP_NAME_AUTHENTICATION_STATE_CACHE = "authenticationStateCache" ;
20
21
public static final String PROP_NAME_MAX_API_KEY_EXPIRY_AGE = "maxApiKeyExpiryAge" ;
21
22
22
23
private final CacheConfig apiKeyCache ;
24
+ private final CacheConfig authenticationStateCache ;
23
25
private final StroomDuration maxApiKeyExpiryAge ;
24
26
private final StroomOpenIdConfig openIdConfig ;
25
27
private final boolean preventLogin ;
@@ -29,6 +31,10 @@ public AuthenticationConfig() {
29
31
.maximumSize (1_000L )
30
32
.expireAfterWrite (StroomDuration .ofSeconds (60 ))
31
33
.build ();
34
+ authenticationStateCache = CacheConfig .builder ()
35
+ .maximumSize (1_000L )
36
+ .expireAfterWrite (StroomDuration .ofMinutes (10 ))
37
+ .build ();
32
38
maxApiKeyExpiryAge = StroomDuration .ofDays (365 );
33
39
openIdConfig = new StroomOpenIdConfig ();
34
40
preventLogin = false ;
@@ -37,11 +43,12 @@ public AuthenticationConfig() {
37
43
@ JsonCreator
38
44
public AuthenticationConfig (
39
45
@ JsonProperty (PROP_NAME_API_KEY_CACHE ) final CacheConfig apiKeyCache ,
46
+ @ JsonProperty (PROP_NAME_AUTHENTICATION_STATE_CACHE ) final CacheConfig authenticationStateCache ,
40
47
@ JsonProperty (PROP_NAME_MAX_API_KEY_EXPIRY_AGE ) final StroomDuration maxApiKeyExpiryAge ,
41
48
@ JsonProperty (PROP_NAME_OPENID ) final StroomOpenIdConfig openIdConfig ,
42
49
@ JsonProperty (PROP_NAME_PREVENT_LOGIN ) final boolean preventLogin ) {
43
-
44
50
this .apiKeyCache = apiKeyCache ;
51
+ this .authenticationStateCache = authenticationStateCache ;
45
52
this .maxApiKeyExpiryAge = maxApiKeyExpiryAge ;
46
53
this .openIdConfig = openIdConfig ;
47
54
this .preventLogin = preventLogin ;
@@ -52,6 +59,11 @@ public CacheConfig getApiKeyCache() {
52
59
return apiKeyCache ;
53
60
}
54
61
62
+ @ JsonProperty (PROP_NAME_AUTHENTICATION_STATE_CACHE )
63
+ public CacheConfig getAuthenticationStateCache () {
64
+ return authenticationStateCache ;
65
+ }
66
+
55
67
@ JsonProperty (PROP_NAME_MAX_API_KEY_EXPIRY_AGE )
56
68
@ JsonPropertyDescription ("The maximum expiry age for new API keys. Defaults to 365 days." )
57
69
@ NotNull
@@ -65,7 +77,7 @@ public StroomOpenIdConfig getOpenIdConfig() {
65
77
}
66
78
67
79
@ JsonPropertyDescription ("Prevent new logins to the system. This is useful if the system is scheduled to " +
68
- "have an outage." )
80
+ "have an outage." )
69
81
@ JsonProperty (PROP_NAME_PREVENT_LOGIN )
70
82
public boolean isPreventLogin () {
71
83
return preventLogin ;
@@ -74,10 +86,11 @@ public boolean isPreventLogin() {
74
86
@ Override
75
87
public String toString () {
76
88
return "AuthenticationConfig{" +
77
- "apiKeyCache=" + apiKeyCache +
78
- ", maxApiKeyExpiryAge=" + maxApiKeyExpiryAge +
79
- ", openIdConfig=" + openIdConfig +
80
- ", preventLogin=" + preventLogin +
81
- '}' ;
89
+ "apiKeyCache=" + apiKeyCache +
90
+ ", authenticationStateCache=" + authenticationStateCache +
91
+ ", maxApiKeyExpiryAge=" + maxApiKeyExpiryAge +
92
+ ", openIdConfig=" + openIdConfig +
93
+ ", preventLogin=" + preventLogin +
94
+ '}' ;
82
95
}
83
96
}
0 commit comments