Code example for AuthState

Methods: getAuthScheme

0
			CredentialsProvider credsProvider = (CredentialsProvider) context 
					.getAttribute(ClientContext.CREDS_PROVIDER); 
			HttpHost targetHost = (HttpHost) context 
					.getAttribute(ExecutionContext.HTTP_TARGET_HOST); 
 
			if (authState.getAuthScheme() == null) { 
				AuthScope authScope = new AuthScope(targetHost.getHostName(), 
						targetHost.getPort()); 
				Credentials creds = credsProvider.getCredentials(authScope); 
				if (creds != null) { 
					authState.setAuthScheme(new BasicScheme()); 
					authState.setCredentials(creds); 
				} 
			} 
		} 
	}; 
 
	/** 
	 * Setup Credentials for HTTP Basic Auth 给HTTP基本认证设置证书 
	 *  
Experience pair programming with AI  Get Codota for Java