Constants.AUTHENTICATION_FAILED_ERROR_MESSAGE, e); Validate.isTrue(token.isSet(), "Authenticated Token is NOT present. The request cannot proceed.");
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0);
private boolean isTokenKerberos(AuthenticatedURL.Token token) throws AuthenticationException { if (token.isSet()) { AuthToken aToken = AuthToken.parse(token.toString()); if (aToken.getType().equals("kerberos") || aToken.getType().equals("kerberos-dt")) { return true; } } return false; }
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0);
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0);
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0);
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0);
URL url = new URL(getBaseURL()); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); Assert.assertFalse(token.isSet()); TestConnectionConfigurator connConf = new TestConnectionConfigurator(); AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
URL url = new URL(getBaseURL()); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); Assert.assertFalse(token.isSet()); TestConnectionConfigurator connConf = new TestConnectionConfigurator(); AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
URL url = new URL(getBaseURL()); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); Assert.assertFalse(token.isSet()); TestConnectionConfigurator connConf = new TestConnectionConfigurator(); AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
@Test public void testExtractTokenFail() throws Exception { HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_UNAUTHORIZED); String tokenStr = "foo"; Map<String, List<String>> headers = new HashMap<String, List<String>>(); List<String> cookies = new ArrayList<String>(); cookies.add(AuthenticatedURL.AUTH_COOKIE + "=" + tokenStr); headers.put("Set-Cookie", cookies); Mockito.when(conn.getHeaderFields()).thenReturn(headers); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); token.set("bar"); try { AuthenticatedURL.extractToken(conn, token); Assert.fail(); } catch (AuthenticationException ex) { // Expected Assert.assertFalse(token.isSet()); } catch (Exception ex) { Assert.fail(); } }
@Test public void testExtractTokenFail() throws Exception { HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_UNAUTHORIZED); String tokenStr = "foo"; Map<String, List<String>> headers = new HashMap<String, List<String>>(); List<String> cookies = new ArrayList<String>(); cookies.add(AuthenticatedURL.AUTH_COOKIE + "=" + tokenStr); headers.put("Set-Cookie", cookies); Mockito.when(conn.getHeaderFields()).thenReturn(headers); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); token.set("bar"); try { AuthenticatedURL.extractToken(conn, token); Assert.fail(); } catch (AuthenticationException ex) { // Expected Assert.assertFalse(token.isSet()); } catch (Exception ex) { Assert.fail(); } }
@Test public void testExtractTokenFail() throws Exception { HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_UNAUTHORIZED); String tokenStr = "foo"; Map<String, List<String>> headers = new HashMap<String, List<String>>(); List<String> cookies = new ArrayList<String>(); cookies.add(AuthenticatedURL.AUTH_COOKIE + "=" + tokenStr); headers.put("Set-Cookie", cookies); Mockito.when(conn.getHeaderFields()).thenReturn(headers); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); token.set("bar"); try { AuthenticatedURL.extractToken(conn, token); Assert.fail(); } catch (AuthenticationException ex) { // Expected Assert.assertFalse(token.isSet()); } catch (Exception ex) { Assert.fail(); } }
private boolean isTokenKerberos(AuthenticatedURL.Token token) throws AuthenticationException { if (token.isSet()) { AuthToken aToken = AuthToken.parse(token.toString()); if (aToken.getType().equals("kerberos") || aToken.getType().equals("kerberos-dt")) { return true; } } return false; }
private boolean isTokenKerberos(AuthenticatedURL.Token token) throws AuthenticationException { if (token.isSet()) { AuthToken aToken = AuthToken.parse(token.toString()); if (aToken.getType().equals("kerberos") || aToken.getType().equals("kerberos-dt")) { return true; } } return false; }
private boolean isTokenKerberos(AuthenticatedURL.Token token) throws AuthenticationException { if (token.isSet()) { AuthToken aToken = AuthToken.parse(token.toString()); if (aToken.getType().equals("kerberos") || aToken.getType().equals("kerberos-dt")) { return true; } } return false; }
private boolean isTokenKerberos(AuthenticatedURL.Token token) throws AuthenticationException { if (token.isSet()) { AuthToken aToken = AuthToken.parse(token.toString()); if (aToken.getType().equals("kerberos") || aToken.getType().equals("kerberos-dt")) { return true; } } return false; }