From 27d4a96b16f8809dc6754a695894b30b2f897de2 Mon Sep 17 00:00:00 2001 From: R Searls Date: Sat, 11 Jan 2025 14:52:41 -0500 Subject: [PATCH] changed constant POST_LOGOUT_PATH to POST_LOGOUT_URI to reflect required data type --- .../java/org/wildfly/security/http/oidc/Oidc.java | 2 +- .../http/oidc/OidcClientConfigurationBuilder.java | 14 +++++++------- .../http/oidc/LogoutConfigurationOptionsTest.java | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/http/oidc/src/main/java/org/wildfly/security/http/oidc/Oidc.java b/http/oidc/src/main/java/org/wildfly/security/http/oidc/Oidc.java index cbff772366..b78a249c84 100644 --- a/http/oidc/src/main/java/org/wildfly/security/http/oidc/Oidc.java +++ b/http/oidc/src/main/java/org/wildfly/security/http/oidc/Oidc.java @@ -175,7 +175,7 @@ public class Oidc { public static final String PROVIDER_URL = "provider-url"; public static final String LOGOUT_PATH = "logout-path"; public static final String LOGOUT_CALLBACK_PATH = "logout-callback-path"; - public static final String POST_LOGOUT_PATH = "post-logout-path"; + public static final String POST_LOGOUT_URI = "post-logout-path"; public static final String LOGOUT_SESSION_REQUIRED = "logout-session-required"; /** diff --git a/http/oidc/src/main/java/org/wildfly/security/http/oidc/OidcClientConfigurationBuilder.java b/http/oidc/src/main/java/org/wildfly/security/http/oidc/OidcClientConfigurationBuilder.java index 51a2477386..c58e96c524 100644 --- a/http/oidc/src/main/java/org/wildfly/security/http/oidc/OidcClientConfigurationBuilder.java +++ b/http/oidc/src/main/java/org/wildfly/security/http/oidc/OidcClientConfigurationBuilder.java @@ -27,7 +27,7 @@ import static org.wildfly.security.http.oidc.Oidc.TokenStore; import static org.wildfly.security.http.oidc.Oidc.LOGOUT_PATH; import static org.wildfly.security.http.oidc.Oidc.LOGOUT_CALLBACK_PATH; -import static org.wildfly.security.http.oidc.Oidc.POST_LOGOUT_PATH; +import static org.wildfly.security.http.oidc.Oidc.POST_LOGOUT_URI; import static org.wildfly.security.http.oidc.Oidc.LOGOUT_SESSION_REQUIRED; import java.io.IOException; @@ -226,13 +226,13 @@ protected OidcClientConfiguration internalBuild(final OidcJsonConfiguration oidc } } - String tmpPostLogoutPath = System.getProperty(POST_LOGOUT_PATH); - log.debug("sysProp POST_LOGOUT_PATH: " + (tmpPostLogoutPath == null ? "NULL" : tmpPostLogoutPath)); - if (tmpPostLogoutPath != null) { - if (isValidPath(tmpPostLogoutPath) || tmpPostLogoutPath.startsWith("http")) { - oidcClientConfiguration.setPostLogoutPath(tmpPostLogoutPath); + String tmpPostLogoutUri = System.getProperty(POST_LOGOUT_URI); + log.debug("sysProp POST_LOGOUT_URI: " + (tmpPostLogoutUri == null ? "NULL" : tmpPostLogoutUri)); + if (tmpPostLogoutUri != null) { + if (isValidPath(tmpPostLogoutUri) || tmpPostLogoutUri.startsWith("http")) { + oidcClientConfiguration.setPostLogoutPath(tmpPostLogoutUri); } else { - throw log.invalidLogoutPath(tmpPostLogoutPath, POST_LOGOUT_PATH); + throw log.invalidLogoutPath(tmpPostLogoutUri, POST_LOGOUT_URI); } } diff --git a/http/oidc/src/test/java/org/wildfly/security/http/oidc/LogoutConfigurationOptionsTest.java b/http/oidc/src/test/java/org/wildfly/security/http/oidc/LogoutConfigurationOptionsTest.java index c6fb24cf75..0f9560aeba 100644 --- a/http/oidc/src/test/java/org/wildfly/security/http/oidc/LogoutConfigurationOptionsTest.java +++ b/http/oidc/src/test/java/org/wildfly/security/http/oidc/LogoutConfigurationOptionsTest.java @@ -44,7 +44,7 @@ public void before() { public void after() { System.clearProperty(Oidc.LOGOUT_PATH); System.clearProperty(Oidc.LOGOUT_CALLBACK_PATH); - System.clearProperty(Oidc.POST_LOGOUT_PATH); + System.clearProperty(Oidc.POST_LOGOUT_URI); } @Test @@ -100,19 +100,19 @@ public void testCallbackLogoutPath() { public void testPostLogoutPath() { try { - System.setProperty(Oidc.POST_LOGOUT_PATH, " "); + System.setProperty(Oidc.POST_LOGOUT_URI, " "); OidcClientConfigurationBuilder.build(oidcJsonConfiguration); - fail("Empty " +Oidc.POST_LOGOUT_PATH+ " is invalid"); + fail("Empty " +Oidc.POST_LOGOUT_URI+ " is invalid"); } catch (Exception e) { - assertTrue(e.getMessage().endsWith(Oidc.POST_LOGOUT_PATH)); + assertTrue(e.getMessage().endsWith(Oidc.POST_LOGOUT_URI)); } try { - System.setProperty(Oidc.POST_LOGOUT_PATH, "/"); + System.setProperty(Oidc.POST_LOGOUT_URI, "/"); OidcClientConfigurationBuilder.build(oidcJsonConfiguration); - fail("/ in " + Oidc.POST_LOGOUT_PATH + " is invalid"); + fail("/ in " + Oidc.POST_LOGOUT_URI + " is invalid"); } catch (Exception e) { - assertTrue(e.getMessage().endsWith(Oidc.POST_LOGOUT_PATH)); + assertTrue(e.getMessage().endsWith(Oidc.POST_LOGOUT_URI)); } } }