Package org.apache.http.auth

Examples of org.apache.http.auth.AuthState.update()


                .setStream(instream2)
                .build());

        final AuthState proxyAuthState = new AuthState();
        proxyAuthState.setState(AuthProtocolState.SUCCESS);
        proxyAuthState.update(new NTLMScheme(), new NTCredentials("user:pass"));

        final HttpClientContext context = new HttpClientContext();
        context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);

        Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
View Full Code Here


              targetHost.getHostName(), targetHost.getPort()));
          if (creds == null) {
            throw new HttpException(
                "No credentials for preemptive authentication");
          }
          authState.update(authScheme, creds);
        }
      }
    }
  }
  private static String parseAttachementId(String patch) {
View Full Code Here

        if (targetAuthState != null) {
            final URI requestURI = request.getURI();
            if (requestURI != null) {
                final String userinfo = requestURI.getUserInfo();
                if (userinfo != null) {
                    targetAuthState.update(new BasicScheme(), new UsernamePasswordCredentials(
                        userinfo));
                }
            }
        }
View Full Code Here

  public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
        AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE);

        if (authState.getAuthScheme() == null) {
            Credentials creds = new UsernamePasswordCredentials(myUsername, myPassword);
            authState.update(new BasicScheme(), creds);
        }

    }

}
View Full Code Here

        final HttpRequestWrapper request = HttpRequestWrapper.wrap(get);
        final HttpClientContext context = HttpClientContext.create();

        final AuthState targetAuthState = new AuthState();
        targetAuthState.setState(AuthProtocolState.SUCCESS);
        targetAuthState.update(new BasicScheme(), new UsernamePasswordCredentials("user:pass"));
        final AuthState proxyAuthState = new AuthState();
        proxyAuthState.setState(AuthProtocolState.SUCCESS);
        proxyAuthState.update(new NTLMScheme(), new NTCredentials("user:pass"));
        context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, targetAuthState);
        context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);
View Full Code Here

        final AuthState targetAuthState = new AuthState();
        targetAuthState.setState(AuthProtocolState.SUCCESS);
        targetAuthState.update(new BasicScheme(), new UsernamePasswordCredentials("user:pass"));
        final AuthState proxyAuthState = new AuthState();
        proxyAuthState.setState(AuthProtocolState.SUCCESS);
        proxyAuthState.update(new NTLMScheme(), new NTCredentials("user:pass"));
        context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, targetAuthState);
        context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);

        final CloseableHttpResponse response1 = Mockito.mock(CloseableHttpResponse.class);
        final CloseableHttpResponse response2 = Mockito.mock(CloseableHttpResponse.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.