RestUtil { public static AuthenticationMode checkAuthenticationMode(URI uri, UserBase user) throws IOException, MotuCasException { return RestUtil.checkAuthenticationMode(uri.toString(), null, user); }  static AuthenticationMode checkAuthenticationMode(URI uri, UserBase user); static AuthenticationMode checkAuthenticationMode(URI uri, Proxy proxy, UserBase user); static AuthenticationMode checkAuthenticationMode(String url, UserBase user); static String getLocationHttpHeader(HttpURLConnection urlConnection); static AuthenticationMode checkAuthenticationMode(String url, Proxy proxy, UserBase user); static AuthenticationMode checkAuthenticationMode(MotuCasBadRequestException e); static AuthenticationMode checkAuthenticationMode(URI targetService, Client client, RestUtil.HttpMethod method, UserBase user); static AuthenticationMode checkAuthenticationMode(String targetService, Client client, RestUtil.HttpMethod method, UserBase user); static boolean isCasifiedUrl(URI serviceURL); static boolean isCasifiedUrl(URI serviceURL, boolean ignoreHttp4XX); static boolean isCasifiedUrl(URI serviceURL, Proxy proxy); static boolean isCasifiedUrl(URI serviceURL, Proxy proxy, boolean ignoreHttp4XX); static boolean isCasifiedUrl(String serviceURL); static boolean isCasifiedUrl(String serviceURL, boolean ignoreHttp4XX); static boolean isCasifiedUrl(String serviceURL, Proxy proxy, boolean ignoreHttp4XX); static boolean isCasifiedUrl(String serviceURL, Client client, RestUtil.HttpMethod method); static String appendPath(String prefix, String suffix); static String getCasRestletUrl(Client client, RestUtil.HttpMethod method, String serviceURL, String casRestUrlSuffix); static String getCasRestletUrl(String serviceURL, String casRestUrlSuffix); static String getRedirectUrl(String path); static String getRedirectUrl(String path, Proxy proxy); static String getRedirectUrl(String path, Client client, RestUtil.HttpMethod method); static String extractRedirectUrl(String url, int httpCode); static String getTicketGrantingTicket(String casRestUrl, UserBase user); static String getTicketGrantingTicket(String casRestUrl, String username, String password); static String loginToCAS(String casRestUrl, UserBase user, String serviceURL); static String loginToCAS(String casRestUrl, String username, String password, String serviceURL); static String loginToCASWithTGT(String casRestUrl, String ticketGrantingTicket, String serviceURL); static boolean isNullOrEmpty(String value); static boolean isNullOrEmpty(Collection<?> value); static final InputStream urlToInputStream(String url); static void copyStreamToFile(InputStream input, File destination); static void copy(InputStream in, OutputStream out); static void copy(Reader in, Writer out); static void copy(InputStream in, OutputStream out, int bufferSize); static void copy(Reader in, Writer out, int bufferSize); static final void close(InputStream in); static final void close(OutputStream out); static final void close(Reader in); static final void close(Writer out); static final String CAS_REST_URL_SUFFIX; static final String LOCATION_HTTP_HEADER_KEY; static final String WWW_AUTHENTICATE_HTTP_HEADER_KEY; }
@Test public void checkAuthenticationMode() { Client c = hostIgnoringClient(); UserBase ub = new UserBase(); ub.setCASAuthentication(true); ub.setLogin("adminweb"); ub.setPwd(""); ub.setCasURL("https: try { assertTrue("CAS".equalsIgnoreCase(RestUtil .checkAuthenticationMode("http: assertTrue("CAS".equalsIgnoreCase(RestUtil .checkAuthenticationMode("https: .toString())); assertTrue("CAS".equalsIgnoreCase(RestUtil .checkAuthenticationMode("https: .toString())); assertTrue("CAS".equalsIgnoreCase(RestUtil .checkAuthenticationMode("http: .toString())); } catch (MotuCasBadRequestException e) { e.printStackTrace(); fail(); } catch (MotuCasException e) { e.printStackTrace(); fail(); } }