UaaUrlUtils { public static boolean uriHasMatchingHost(String uri, String hostname) { if (uri == null) { return false; } try { URL url = new URL(uri); return hostname.equals(url.getHost()); } catch (MalformedURLException e) { return false; } }  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 uriHasMatchingHost() { assertTrue(UaaUrlUtils.uriHasMatchingHost("http: assertTrue(UaaUrlUtils.uriHasMatchingHost("http: assertTrue(UaaUrlUtils.uriHasMatchingHost("http: assertFalse(UaaUrlUtils.uriHasMatchingHost(null, "test.com")); assertFalse(UaaUrlUtils.uriHasMatchingHost("http: assertFalse(UaaUrlUtils.uriHasMatchingHost("not-valid-url", "test.com")); assertFalse(UaaUrlUtils.uriHasMatchingHost("http: assertFalse(UaaUrlUtils.uriHasMatchingHost("http: assertFalse(UaaUrlUtils.uriHasMatchingHost("http: }