This is an automated email from the ASF dual-hosted git repository.

pvillard31 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new e40f0f7691b NIFI-15947 Replaced deprecated method expireAfterWrite of 
com.google.common.cache.CacheBuilder (#11258)
e40f0f7691b is described below

commit e40f0f7691bc9de7277d2f3011232843b0fe64a7
Author: dan-s1 <[email protected]>
AuthorDate: Mon May 18 16:35:30 2026 -0400

    NIFI-15947 Replaced deprecated method expireAfterWrite of 
com.google.common.cache.CacheBuilder (#11258)
---
 .../registry/web/security/authentication/oidc/OidcService.java    | 6 ++++--
 .../web/security/authentication/oidc/OidcServiceTest.java         | 8 ++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcService.java
 
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcService.java
index 0ea870ce84e..736c78e5d6d 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcService.java
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcService.java
@@ -31,6 +31,7 @@ import java.net.URI;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.SecureRandom;
+import java.time.Duration;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
@@ -70,8 +71,9 @@ public class OidcService {
 
         identityProvider.initializeProvider();
         this.identityProvider = identityProvider;
-        this.stateLookupForPendingRequests = 
CacheBuilder.newBuilder().expireAfterWrite(duration, units).build();
-        this.jwtLookupForCompletedRequests = 
CacheBuilder.newBuilder().expireAfterWrite(duration, units).build();
+        final Duration expirationDuration = Duration.of(duration, 
units.toChronoUnit());
+        this.stateLookupForPendingRequests = 
CacheBuilder.newBuilder().expireAfterWrite(expirationDuration).build();
+        this.jwtLookupForCompletedRequests = 
CacheBuilder.newBuilder().expireAfterWrite(expirationDuration).build();
     }
 
     /**
diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcServiceTest.java
 
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcServiceTest.java
index 310b9f2e1a6..fe97884695f 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcServiceTest.java
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/security/authentication/oidc/OidcServiceTest.java
@@ -40,7 +40,7 @@ public class OidcServiceTest {
     public static final String TEST_STATE = "test-state";
 
     @Test
-    public void testOidcNotEnabledCreateState() throws Exception {
+    public void testOidcNotEnabledCreateState() {
         final OidcService service = getServiceWithNoOidcSupport();
         assertThrows(IllegalStateException.class, () -> 
service.createState(TEST_REQUEST_IDENTIFIER));
     }
@@ -53,7 +53,7 @@ public class OidcServiceTest {
     }
 
     @Test
-    public void testOidcNotEnabledValidateState() throws Exception {
+    public void testOidcNotEnabledValidateState() {
         final OidcService service = getServiceWithNoOidcSupport();
         assertThrows(IllegalStateException.class, () -> 
service.isStateValid(TEST_REQUEST_IDENTIFIER, new State(TEST_STATE)));
     }
@@ -82,7 +82,7 @@ public class OidcServiceTest {
     }
 
     @Test
-    public void testOidcNotEnabledExchangeCode() throws Exception {
+    public void testOidcNotEnabledExchangeCode() {
         final OidcService service = getServiceWithNoOidcSupport();
         assertThrows(IllegalStateException.class, () -> 
service.exchangeAuthorizationCodeForLoginAuthenticationToken(TEST_REQUEST_IDENTIFIER,
 getAuthorizationCodeGrant()));
     }
@@ -95,7 +95,7 @@ public class OidcServiceTest {
     }
 
     @Test
-    public void testOidcNotEnabledGetJwt() throws Exception {
+    public void testOidcNotEnabledGetJwt() {
         final OidcService service = getServiceWithNoOidcSupport();
         assertThrows(IllegalStateException.class, () -> 
service.getJwt(TEST_REQUEST_IDENTIFIER));
     }

Reply via email to