UaaUrlUtils { public static String getUaaUrl(String path, IdentityZone currentIdentityZone) { return getUaaUrl(path, false, currentIdentityZone); }  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 getUaaUrl() { assertEquals("http: }
@Test void zoneAwareUaaUrl() { IdentityZone zone = MultitenancyFixture.identityZone("id", "subdomain"); assertEquals("http: assertEquals("http: }
@Test void getUaaUrlWithPath() { assertEquals("http: }
@Test void getUaaUrlWithZone() { 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("http: }
@Test void getUaaUrlWithZoneAndPath() { 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("http: }
@Test void localhostPortAndContextPathUrl() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("localhost"); request.setServerPort(8080); request.setContextPath("/uaa"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); String url = UaaUrlUtils.getUaaUrl("/something", IdentityZone.getUaa()); assertThat(url, is("http: }
@Test void securityProtocol() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("https"); request.setServerPort(8443); request.setServerName("localhost"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); String url = UaaUrlUtils.getUaaUrl("/something", IdentityZone.getUaa()); assertThat(url, is("https: }
@Test void multiDomainUrls() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("login.localhost"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); String url = UaaUrlUtils.getUaaUrl("/something", IdentityZone.getUaa()); assertThat(url, is("http: }
@Test void zonedAndMultiDomainUrls() { IdentityZone zone = MultitenancyFixture.identityZone("testzone1-id", "testzone1"); MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("testzone1.login.localhost"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); String url = UaaUrlUtils.getUaaUrl("/something", zone); assertThat(url, is("http: }
@Test void xForwardedPrefixHeaderIsIgnored() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("login.localhost"); request.addHeader("X-Forwarded-Prefix", "/prefix"); ServletRequestAttributes attrs = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attrs); String url = UaaUrlUtils.getUaaUrl("/something", IdentityZone.getUaa()); assertThat(url, is("http: }