Code example for AuthState

Methods: getAuthScheme

0
                    .getAttribute(ClientContext.CREDS_PROVIDER); 
            final HttpHost targetHost = (HttpHost) context 
                    .getAttribute(ExecutionContext.HTTP_TARGET_HOST); 
 
            // If not auth scheme has been initialized yet 
            if (authState.getAuthScheme() == null) { 
                final AuthScope authScope = new AuthScope(targetHost.getHostName(), 
                        targetHost.getPort()); 
                // Obtain credentials matching the target host 
                final Credentials creds = credsProvider.getCredentials(authScope); 
                // If found, generate BasicScheme preemptively 
                if (creds != null) { 
                    if (creds.getUserPrincipal() != null) { 
                        if (DEBUG) { 
                            Log.d("NetworkClient", "Pre-emptively authenticating as: " 
                                    + creds.getUserPrincipal().getName()); 
                        } 
                    } 
                    authState.setAuthScheme(new BasicScheme()); 
                    authState.setCredentials(creds); 
Stop searching for code, let great code find you!  Add Codota to your java IDE