@Test(dataProvider = "invalidLogoutURL", expectedExceptions = IllegalArgumentException.class) public void testReplaceIdTokenWithPlaceholderWithInvalidLogoutUrl(String logoutURL) throws Exception { 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);  }