@@ -76,6 +76,10 @@ Some of the details you can supply are common to different use cases:
76
76
with the
77
77
[ Microsoft Authentication Library (MSAL)] ( https://learn.microsoft.com/en-us/entra/identity-platform/msal-overview )
78
78
79
+ (See [ Advanced configuration options] ( #advanced-configuration-options ) below
80
+ to learn more about the options for controlling token request retry and timeout
81
+ behavior.)
82
+
79
83
You can also add configuration to authenticate with a [ service principal] ( #serv-principal )
80
84
or a [ managed identity] ( #mgd-identity ) as described in the sections below.
81
85
@@ -163,3 +167,37 @@ UnifiedJedis jedis = new UnifiedJedis(
163
167
// Test the connection.
164
168
System . out. println(String . format(" Database size is %d" , jedis. dbSize()));
165
169
```
170
+
171
+ ## Advanced configuration options
172
+
173
+ The ` TokenAuthConfig ` class has several other options that you can
174
+ set with the ` EntraIDTokenAuthConfigBuilder.builder() ` . These give you
175
+ more precise control over the way the token is renewed:
176
+
177
+ ``` java
178
+ TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder . builder()
179
+ .expirationRefreshRatio(0.75 )
180
+ .lowerRefreshBoundMillis(100 )
181
+ .tokenRequestExecTimeoutInMs(100 )
182
+ .maxAttemptsToRetry(10 )
183
+ .delayInMsToRetry()
184
+ // ...
185
+ .build();
186
+ ```
187
+
188
+ These options are explained below:
189
+
190
+ - ` expirationRefreshRatio ` : a ` float ` value representing the fraction
191
+ of a token's lifetime that should elapse before attempting to
192
+ refresh it. For example, a value of 0.75 means that you want to
193
+ refresh the token after 75% of its lifetime has passed.
194
+ - ` lowerRefreshBoundMillis ` : the minimum amount of the token's lifetime
195
+ (in milliseconds) remaining before attempting to refresh, regardless
196
+ of the ` expirationRefreshRatio ` value. Set this to zero if you want
197
+ the refresh time to depend only on ` expirationRefreshRatio ` .
198
+ - ` tokenRequestExecTimeoutInMs ` : the maximum time (in milliseconds) to
199
+ wait for a token request to complete before retrying.
200
+ - ` maxAttemptsToRetry ` : the maximum number of times to retry a token
201
+ request before aborting.
202
+ - ` delayInMsToRetry ` : the time (in milliseconds) to wait before
203
+ retrying a token request after a failed attempt.
0 commit comments