Examples of Credentials


Examples of org.apache.commons.httpclient.Credentials

        throws Exception
    {
        TestSuite suite = new TestSuite();

        HttpClient adminClient = new HttpClient();
        Credentials defaultcreds = new UsernamePasswordCredentials("Admin", "admin");
        adminClient.getState().setCredentials(AuthScope.ANY, defaultcreds);

        addRSSURLsForAdmin(validationTest, validator, suite, adminClient);

        HttpClient guestClient = new HttpClient();
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

    {
        if (AbstractEscapingTest.client == null) {
            HttpClient adminClient = new HttpClient();

            // set up admin credentials
            Credentials defaultcreds = new UsernamePasswordCredentials("Admin", "admin");
            adminClient.getState().setCredentials(AuthScope.ANY, defaultcreds);

            // set up client parameters
            HttpClientParams clientParams = new HttpClientParams();
            clientParams.setSoTimeout(20000);
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

        String host = getRepository().getHost();

        if ( StringUtils.isNotEmpty( username ) && StringUtils.isNotEmpty( password ) )
        {
            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
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

        HttpClient client = new HttpClient();
        client.getHttpConnectionManager().getParams().setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT_SECONDS * 1000);
        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.Credentials

    @Override
    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());
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

    @Override
    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.Credentials

        final PutMethod method = new PutMethod(uri);
        Announcement resultingAnnouncement = null;
        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);
            }
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

        final DeleteMethod method = new DeleteMethod(uri);

        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);
            }
View Full Code Here

Examples of org.apache.commons.httpclient.Credentials

        client.getHttpConnectionManager().getParams().setConnectionTimeout(
            5000);

        // authentication stuff
        client.getParams().setAuthenticationPreemptive(true);
        Credentials defaultcreds = new UsernamePasswordCredentials(user,
            password);
        client.getState().setCredentials(AuthScope.ANY, defaultcreds);

        return client;
    }
View Full Code Here

Examples of org.apache.directory.kerberos.credentials.cache.Credentials

     
      PrincipalName princ = new PrincipalName( principal, PrincipalNameType.KRB_NT_PRINCIPAL );
      princ.setRealm( tgt.getRealm() );
      credCache.setPrimaryPrincipalName( princ );
     
      Credentials cred = new Credentials( tgt );
      credCache.addCredentials( cred );
     
      CredentialsCache.store( credCacheFile, credCache );
    }   
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.