Skip to content

Commit

Permalink
changed constant POST_LOGOUT_PATH to POST_LOGOUT_URI to reflect requi…
Browse files Browse the repository at this point in the history
…red data type
  • Loading branch information
rsearls committed Jan 13, 2025
1 parent 369046a commit 27d4a96
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
}
}

0 comments on commit 27d4a96

Please sign in to comment.