UaaUrlUtils { public static String getUaaHost(IdentityZone currentIdentityZone) { return getURIBuilder("", false, currentIdentityZone).build().getHost(); }  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 getHost() { assertEquals("localhost", UaaUrlUtils.getUaaHost(IdentityZone.getUaa())); }
@Test void getHostWithZone() { IdentityZone zone = MultitenancyFixture.identityZone("zone1", "zone1"); MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("zone1.localhost"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); assertEquals("zone1.localhost", UaaUrlUtils.getUaaHost(IdentityZone.getUaa())); }