if (paramHttpResponse == null)
throw new IllegalArgumentException("HTTP response may not be null");
if (paramHttpContext == null)
throw new IllegalArgumentException("HTTP context may not be null");
LinkedList localLinkedList = new LinkedList();
AuthSchemeRegistry localAuthSchemeRegistry = (AuthSchemeRegistry)paramHttpContext.getAttribute("http.authscheme-registry");
if (localAuthSchemeRegistry == null)
{
this.log.debug("Auth scheme registry not set in the context");
return localLinkedList;
}
CredentialsProvider localCredentialsProvider = (CredentialsProvider)paramHttpContext.getAttribute("http.auth.credentials-provider");
if (localCredentialsProvider == null)
{
this.log.debug("Credentials provider not set in the context");
return localLinkedList;
}
List localList = (List)paramHttpResponse.getParams().getParameter(this.prefParamName);
if (localList == null)
localList = DEFAULT_SCHEME_PRIORITY;
if (this.log.isDebugEnabled())
this.log.debug("Authentication schemes in the order of preference: " + localList);
Iterator localIterator = localList.iterator();
while (localIterator.hasNext())
{
String str = (String)localIterator.next();
Header localHeader = (Header)paramMap.get(str.toLowerCase(Locale.US));
if (localHeader != null)
try
{
AuthScheme localAuthScheme = localAuthSchemeRegistry.getAuthScheme(str, paramHttpResponse.getParams());
localAuthScheme.processChallenge(localHeader);
AuthScope localAuthScope = new AuthScope(paramHttpHost.getHostName(), paramHttpHost.getPort(), localAuthScheme.getRealm(), localAuthScheme.getSchemeName());
Credentials localCredentials = localCredentialsProvider.getCredentials(localAuthScope);
if (localCredentials != null)
localLinkedList.add(new AuthOption(localAuthScheme, localCredentials));