String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
/** * Performs simple authentication against the specified URL. * <p> * If a token is given it does a NOP and returns the given token. * <p> * If no token is given, it will perform an HTTP <code>OPTIONS</code> request injecting an additional * parameter {@link #USER_NAME} in the query string with the value returned by the {@link #getUserName()} * method. * <p> * If the response is successful it will update the authentication token. * * @param url the URl to authenticate against. * @param token the authentication token being used for the user. * * @throws IOException if an IO error occurred. * @throws AuthenticationException if an authentication error occurred. */ @Override public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = token.openConnection(url, connConfigurator); conn.setRequestMethod("OPTIONS"); conn.connect(); AuthenticatedURL.extractToken(conn, token); }
String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String strUrl = url.toString(); String paramSeparator = (strUrl.contains("?")) ? "&" : "?"; strUrl += paramSeparator + USER_NAME_EQ + getUserName(); url = new URL(strUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
@Test public void testGetUserName() throws Exception { PseudoAuthenticator authenticator = new PseudoAuthenticator(); Assert.assertEquals(System.getProperty("user.name"), authenticator.getUserName()); }
@Test public void testGetUserName() throws Exception { PseudoAuthenticator authenticator = new PseudoAuthenticator(); Assert.assertEquals(System.getProperty("user.name"), authenticator.getUserName()); }
@Test public void testGetUserName() throws Exception { PseudoAuthenticator authenticator = new PseudoAuthenticator(); Assert.assertEquals(System.getProperty("user.name"), authenticator.getUserName()); }