Code example for AuthState

Methods: getAuthScheme

0
					.getAttribute(ClientContext.CREDS_PROVIDER); 
			HttpHost targetHost = (HttpHost) context 
					.getAttribute(ExecutionContext.HTTP_TARGET_HOST); 
 
			// If not auth scheme has been initialized yet 
			if (authState.getAuthScheme() == null) { 
				AuthScope authScope = new AuthScope(targetHost.getHostName(), 
						targetHost.getPort()); 
				// Obtain credentials matching the target host 
				org.apache.http.auth.Credentials creds = credsProvider 
						.getCredentials(authScope); 
				// If found, generate BasicScheme preemptively 
				if (creds != null) { 
					authState.setAuthScheme(new BasicScheme()); 
					authState.setCredentials(creds); 
				} 
			} 
		} 
 
	}; 
Experience pair programming with AI  Get Codota for Java