@Test public void testReplaceIdTokenWithPlaceholderSuccess() throws Exception { String logoutURL = "https: "iOiJhLVhxc2phS1NZYTdYQmVuRG55anlpRkFJUGNVbS1xMXJvUkszcG02TDdzIiwic3ViIjoiYWRtaW5pc3RyYXRvckBlc3hjbG91ZCIsIml" + "zcyI6Imh0dHBzOlwvXC8xMC4xNDYuMzkuOTlcL29wZW5pZGNvbm5lY3RcL2VzeGNsb3VkIiwiZ2l2ZW5fbmFtZSI6IkFkbWluaXN0cmF0b3I" + "iLCJpYXQiOjE0MzgzNzAwMzAsImV4cCI6MTQzODM4NDQzMCwidG9rZW5fY2xhc3MiOiJpZF90b2tlbiIsInRlbmFudCI6ImVzeGNsb3VkIiw" + "ibm9uY2UiOiIxIiwiYXVkIjoiYjM3MWU5ZDAtMGNiYi00MzM5LWE2MjQtZWNiZTI4MjcwNThmIiwiZmFtaWx5X25hbWUiOiJlc3hjbG91ZCI" + "sImp0aSI6IjhycVAwUzYybEFjS2dsV0VYNmhLa29kNmVrTl93ellfRFk5RzdhWlFrbnMiLCJ0b2tlbl90eXBlIjoiQmVhcmVyIn0.MowzDrk" + "7DPEv9T_a6F2xJFBwNljYnr7QSX5PjDYJ2pneRlhVELsRcI7Cqg0g4TSPKxfgFqg8KCVYTOm0gmGVt-K6zaxaTs3BkvbVOdEjLJY4RVGtEzG" + "PHZ4oLHcpWH-VKdZ_WGfnmTQ_8VlDj5aEwKClEDHIW4QG7Mai7WSdZwANhQrJ_T_ZpVQRKM7LffaHcPeTBgMZi5gWl6mAzGrY_5e4bLkw9FS" + "gJQeKSNSYeZ-c437yYvU1dmgzx2A2yR5fmbxnI3eAkNSWB9U5ZujHUntfp4sOcKNTnQKWJVbkRcZloj3cR1l_vw4MUGonD8Rt41MZBIUue5u" + "QRctg5rT2HaGVY7kL0dZpmp-9g6Q_SnTsr4oJ3tIMey19VjISx44FUzMHoEvJQgyI-E4BwcIrjoeoPaVchT1Qdbi-Zh5zKK9jGgoPqOjNeSv" + "sR5XVT7Xy857aXL8OFpZ8r4HSoZXT68vnfpqT_eQFdy59Sl6o-xG7_-OU1OUoiYB5OVP8ZqShajZ9kICD7m1SG3QYUnxqlW6I2JsMOsbVOPp" + "BRjPyHnf8k0CcV9ChjtIHHBHjXnh9woszu34_HCkie2n1pALG7AyEIOOdbAv33_rPcGfZJJhwycr4xXd-n6DYGtPDRgHmzKWDveFsLvXoV4t" + "9vW5HgKLFldBrLMPQgWUbpXzWWWs&post_logout_redirect_uri=https%3A%2F%2F10.118.97.239%2Fapi%2Flogin-redirect.htm" + "l&state=E&correlation_id=EMhk6IVFwXs-wUrn90iYHA1aCULgP6sSMfomPcrw8xk"; String logoutURLWithPlaceholder = "https: "CEHOLDER]&post_logout_redirect_uri=https%3A%2F%2F10.118.97.239%2Fapi%2Flogin-redirect.html&state=E&correlati" + "on_id=EMhk6IVFwXs-wUrn90iYHA1aCULgP6sSMfomPcrw8xk"; Assert.assertEquals(new URI(logoutURLWithPlaceholder), AuthClientHandler.replaceIdTokenWithPlaceholder(new URI(logoutURL))); }
public static URI replaceIdTokenWithPlaceholder(URI logoutUri) throws IllegalArgumentException, URISyntaxException, UnsupportedEncodingException{ String placeholderValue = ""; String keyToMatch = URLDecoder.decode(LOGOUT_URL_ID_TOKEN_START, "UTF-8"); final String urlQuery = logoutUri.getQuery(); if (urlQuery == null) { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } final String[] queryParams = urlQuery.split("&"); for (String param : queryParams) { final String[] pairs = param.split("="); if (pairs[0].equals(keyToMatch)) { placeholderValue = pairs[1]; break; } } if (placeholderValue == "") { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } String logoutStr = logoutUri.toString(); return new URI(logoutStr.replace(placeholderValue, LOGOUT_URL_ID_TOKEN_PLACEHOLDER)); }
AuthClientHandler { public static URI replaceIdTokenWithPlaceholder(URI logoutUri) throws IllegalArgumentException, URISyntaxException, UnsupportedEncodingException{ String placeholderValue = ""; String keyToMatch = URLDecoder.decode(LOGOUT_URL_ID_TOKEN_START, "UTF-8"); final String urlQuery = logoutUri.getQuery(); if (urlQuery == null) { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } final String[] queryParams = urlQuery.split("&"); for (String param : queryParams) { final String[] pairs = param.split("="); if (pairs[0].equals(keyToMatch)) { placeholderValue = pairs[1]; break; } } if (placeholderValue == "") { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } String logoutStr = logoutUri.toString(); return new URI(logoutStr.replace(placeholderValue, LOGOUT_URL_ID_TOKEN_PLACEHOLDER)); } }
AuthClientHandler { public static URI replaceIdTokenWithPlaceholder(URI logoutUri) throws IllegalArgumentException, URISyntaxException, UnsupportedEncodingException{ String placeholderValue = ""; String keyToMatch = URLDecoder.decode(LOGOUT_URL_ID_TOKEN_START, "UTF-8"); final String urlQuery = logoutUri.getQuery(); if (urlQuery == null) { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } final String[] queryParams = urlQuery.split("&"); for (String param : queryParams) { final String[] pairs = param.split("="); if (pairs[0].equals(keyToMatch)) { placeholderValue = pairs[1]; break; } } if (placeholderValue == "") { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } String logoutStr = logoutUri.toString(); return new URI(logoutStr.replace(placeholderValue, LOGOUT_URL_ID_TOKEN_PLACEHOLDER)); } AuthClientHandler(
      AuthOIDCClient oidcClient,
      IdmClient idmClient,
      AuthTokenHandler tokenHandler,
      String user,
      String password,
      String tenant); }
AuthClientHandler { public static URI replaceIdTokenWithPlaceholder(URI logoutUri) throws IllegalArgumentException, URISyntaxException, UnsupportedEncodingException{ String placeholderValue = ""; String keyToMatch = URLDecoder.decode(LOGOUT_URL_ID_TOKEN_START, "UTF-8"); final String urlQuery = logoutUri.getQuery(); if (urlQuery == null) { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } final String[] queryParams = urlQuery.split("&"); for (String param : queryParams) { final String[] pairs = param.split("="); if (pairs[0].equals(keyToMatch)) { placeholderValue = pairs[1]; break; } } if (placeholderValue == "") { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } String logoutStr = logoutUri.toString(); return new URI(logoutStr.replace(placeholderValue, LOGOUT_URL_ID_TOKEN_PLACEHOLDER)); } AuthClientHandler(
      AuthOIDCClient oidcClient,
      IdmClient idmClient,
      AuthTokenHandler tokenHandler,
      String user,
      String password,
      String tenant); ImplicitClient registerImplicitClient(URI loginRedirectURI, URI logoutRedirectURI); OIDCClientDTO registerClient(URI redirectURI); URI buildAuthenticationRequestURI(ClientID clientID, URI redirectURI); static URI replaceIdTokenWithPlaceholder(URI logoutUri); }
AuthClientHandler { public static URI replaceIdTokenWithPlaceholder(URI logoutUri) throws IllegalArgumentException, URISyntaxException, UnsupportedEncodingException{ String placeholderValue = ""; String keyToMatch = URLDecoder.decode(LOGOUT_URL_ID_TOKEN_START, "UTF-8"); final String urlQuery = logoutUri.getQuery(); if (urlQuery == null) { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } final String[] queryParams = urlQuery.split("&"); for (String param : queryParams) { final String[] pairs = param.split("="); if (pairs[0].equals(keyToMatch)) { placeholderValue = pairs[1]; break; } } if (placeholderValue == "") { throw new IllegalArgumentException(String.format("Logout URL %s has invalid format", logoutUri.toString())); } String logoutStr = logoutUri.toString(); return new URI(logoutStr.replace(placeholderValue, LOGOUT_URL_ID_TOKEN_PLACEHOLDER)); } AuthClientHandler(
      AuthOIDCClient oidcClient,
      IdmClient idmClient,
      AuthTokenHandler tokenHandler,
      String user,
      String password,
      String tenant); ImplicitClient registerImplicitClient(URI loginRedirectURI, URI logoutRedirectURI); OIDCClientDTO registerClient(URI redirectURI); URI buildAuthenticationRequestURI(ClientID clientID, URI redirectURI); static URI replaceIdTokenWithPlaceholder(URI logoutUri);  }