Examples of AuthScope


Examples of org.apache.commons.httpclient.auth.AuthScope

        }
        this.username = System.getProperty(("webdav.test.username"), "");
        this.password = System.getProperty(("webdav.test.password"), "");
        this.client = new HttpClient();
        this.client.getState().setCredentials(
                new AuthScope(this.uri.getHost(), this.uri.getPort()),
                new UsernamePasswordCredentials(this.username, this.password));
        super.setUp();
    }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        {
            Credentials creds = new UsernamePasswordCredentials( username, password );

            int port = getRepository().getPort() > -1 ? getRepository().getPort() : AuthScope.ANY_PORT;

            AuthScope scope = new AuthScope( host, port );
            client.getState().setCredentials( scope, creds );
        }

        HostConfiguration hc = new HostConfiguration();

        ProxyInfo proxyInfo = getProxyInfo( getRepository().getProtocol(), getRepository().getHost() );
        if ( proxyInfo != null )
        {
            String proxyUsername = proxyInfo.getUserName();
            String proxyPassword = proxyInfo.getPassword();
            String proxyHost = proxyInfo.getHost();
            int proxyPort = proxyInfo.getPort();
            String proxyNtlmHost = proxyInfo.getNtlmHost();
            String proxyNtlmDomain = proxyInfo.getNtlmDomain();
            if ( proxyHost != null )
            {
                hc.setProxy( proxyHost, proxyPort );

                if ( proxyUsername != null && proxyPassword != null )
                {
                    Credentials creds;
                    if ( proxyNtlmHost != null || proxyNtlmDomain != null )
                    {
                        creds = new NTCredentials( proxyUsername, proxyPassword, proxyNtlmHost, proxyNtlmDomain );
                    }
                    else
                    {
                        creds = new UsernamePasswordCredentials( proxyUsername, proxyPassword );
                    }

                    int port = proxyInfo.getPort() > -1 ? proxyInfo.getPort() : AuthScope.ANY_PORT;

                    AuthScope scope = new AuthScope( proxyHost, port );
                    client.getState().setProxyCredentials( scope, creds );
                }
            }
        }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

    public Result<ResourceProxy> execute() {
        GetMethod get = new GetMethod(getPath());
      try{
        httpClient.getParams().setAuthenticationPreemptive(true);
          Credentials defaultcreds = new UsernamePasswordCredentials(repositoryInfo.getUsername(), repositoryInfo.getPassword());
          httpClient.getState().setCredentials(new AuthScope(repositoryInfo.getHost(),repositoryInfo.getPort(), AuthScope.ANY_REALM), defaultcreds);
        int responseStatus=httpClient.executeMethod(get);

        //TODO change responseAsString with something like
        //return EncodingUtil.getString(rawdata, m.getResponseCharSet());
            if (!isSuccessStatus(responseStatus))
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

    public Result<ResourceProxy> execute() {
        GetMethod get = new GetMethod(getPath());
      try{
        httpClient.getParams().setAuthenticationPreemptive(true);
          Credentials defaultcreds = new UsernamePasswordCredentials(repositoryInfo.getUsername(), repositoryInfo.getPassword());
          httpClient.getState().setCredentials(new AuthScope(repositoryInfo.getHost(),repositoryInfo.getPort(), AuthScope.ANY_REALM), defaultcreds);
        int responseStatus=httpClient.executeMethod(get);
        //TODO change responseAsString with something like
        // return EncodingUtil.getString(rawdata, m.getResponseCharSet());
            if (!isSuccessStatus(responseStatus))
                return failureResultForStatusCode(responseStatus);
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        try {
            String userInfo = connectorUrl.getUserInfo();
            if (userInfo != null) {
                Credentials c = new UsernamePasswordCredentials(userInfo);
                httpClient.getState().setCredentials(
                        new AuthScope(method.getURI().getHost(), method
                                .getURI().getPort()), c);
            }

            Announcement topologyAnnouncement = new Announcement(
                    clusterViewService.getSlingId());
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        try {
            String userInfo = connectorUrl.getUserInfo();
            if (userInfo != null) {
                Credentials c = new UsernamePasswordCredentials(userInfo);
                httpClient.getState().setCredentials(
                        new AuthScope(method.getURI().getHost(), method
                                .getURI().getPort()), c);
            }

            requestValidator.trustMessage(method, null);
            httpClient.executeMethod(method);
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        client.getHttpConnectionManager().getParams().setSoTimeout(DEFAULT_SOCKET_TIMEOUT_SECONDS * 1000);
        client.getParams().setAuthenticationPreemptive(true);
        Credentials defaultcreds = new UsernamePasswordCredentials(repositoryInfo.getUsername(),
                repositoryInfo.getPassword());
        client.getState().setCredentials(
                new AuthScope(repositoryInfo.getHost(), repositoryInfo.getPort(), AuthScope.ANY_REALM), defaultcreds);
        return client;
    }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

     
      try{
        httpClient.getParams().setAuthenticationPreemptive(true);
          Credentials defaultcreds = new UsernamePasswordCredentials(repositoryInfo.getUsername(), repositoryInfo.getPassword());
          //TODO
          httpClient.getState().setCredentials(new AuthScope(repositoryInfo.getHost(),repositoryInfo.getPort(), AuthScope.ANY_REALM), defaultcreds);
        int responseStatus=httpClient.executeMethod(get);
       
        if ( isSuccessStatus(responseStatus) )
          return AbstractResult.success(get.getResponseBody());
       
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        // setup HTTP client, with authentication (using default Jackrabbit credentials)
        httpClient = new HttpClient();
        httpClient.getParams().setAuthenticationPreemptive(true);
        Credentials defaultcreds = getDefaultCredentials();
        httpClient.getState().setCredentials(new AuthScope(url.getHost(), url.getPort(), AuthScope.ANY_REALM), defaultcreds);

        testClient = new SlingIntegrationTestClient(httpClient);

        waitForSlingStartup();
    }
View Full Code Here

Examples of org.apache.http.auth.AuthScope

    HttpHost proxy = new HttpHost(proxyHost, proxyPort);
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
  }

  public static void setProxy(String proxyHost, int proxyPort, String username, String password) {
    httpclient.getCredentialsProvider().setCredentials(new AuthScope(proxyHost, proxyPort),
        new UsernamePasswordCredentials(username, password));
    setProxy(proxyHost, proxyPort);
  }
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.