public Authorization Authenticate(string challenge, WebRequest webRequest, ICredentials credentials) {
GlobalLog.Print("BasicClient::Authenticate(): " + challenge);
GlobalLog.Assert(credentials != null, "BasicClient::Authenticate()|credentials == null");
if (credentials==null) {
return null;
}
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
GlobalLog.Assert(httpWebRequest != null, "BasicClient::Authenticate()|httpWebRequest == null");
if (httpWebRequest==null || httpWebRequest.ChallengedUri==null) {
//
// there has been no challenge:
// 1) the request never went on the wire
// 2) somebody other than us is calling into AuthenticationManager
//
return null;
}
int index = AuthenticationManager.FindSubstringNotInQuotes(challenge, Signature);
if (index < 0) {
return null;
}
return Lookup(httpWebRequest, credentials);
}