UaaUrlUtils { public static String findMatchingRedirectUri(Collection<String> redirectUris, String requestedRedirectUri, String fallbackRedirectUri) { AntPathMatcher matcher = new AntPathMatcher(); for (String pattern : ofNullable(redirectUris).orElse(emptyList())) { if (matcher.match(pattern, requestedRedirectUri)) { return requestedRedirectUri; } } return ofNullable(fallbackRedirectUri).orElse(requestedRedirectUri); }  static String getUaaUrl(String path, IdentityZone currentIdentityZone); static String getUaaUrl(String path, boolean zoneSwitchPossible, IdentityZone currentIdentityZone); static String getUaaHost(IdentityZone currentIdentityZone); static boolean isValidRegisteredRedirectUrl(String url); static boolean isValidSubdomain(String subdomain); static String findMatchingRedirectUri(Collection<String> redirectUris, String requestedRedirectUri, String fallbackRedirectUri); static String getHostForURI(String uri); static String getBaseURL(HttpServletRequest request); static Map<String, String[]> getParameterMap(String uri); static boolean isUrl(String url); static String addQueryParameter(String url, String name, String value); static String addFragmentComponent(String urlString, String component); static String addSubdomainToUrl(String url, String subdomain); static String getSubdomain(String subdomain); static String extractPathVariableFromUrl(int pathParameterIndex, String path); static String getRequestPath(HttpServletRequest request); static boolean uriHasMatchingHost(String uri, String hostname); static String normalizeUri(String uri);  }
@Test void findMatchingRedirectUri_usesAntPathMatching() { String matchingRedirectUri1 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton("http: assertThat(matchingRedirectUri1, equalTo("http: String matchingRedirectUri2 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton("http: assertThat(matchingRedirectUri2, equalTo("http: matchingRedirectUri2 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton("http: assertThat(matchingRedirectUri2, equalTo("http: matchingRedirectUri2 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton("http: assertThat(matchingRedirectUri2, equalTo("http: String pattern2 = "http: String redirect3 = "http: String matchingRedirectUri3 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton(pattern2), redirect3, null); assertThat(matchingRedirectUri3, equalTo(redirect3)); String pattern3 = "http: String redirect4 = "http: String matchingRedirectUri4 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton(pattern3), redirect4, null); assertThat(matchingRedirectUri4, equalTo(redirect4)); String redirect5 = "http: String fallback = "http: String matchingRedirectUri5 = UaaUrlUtils.findMatchingRedirectUri(Collections.singleton(pattern3), redirect5, fallback); assertThat(matchingRedirectUri5, equalTo(fallback)); }