public Authorization Authenticate(string challenge, NetworkCredential credential, object sessionCookie, string spn, ChannelBinding channelBindingToken)
{
if (NetEventSource.IsEnabled) NetEventSource.Enter(this, "Authenticate");
try
{
lock (_sessions)
{
NTAuthentication clientContext;
if (!_sessions.TryGetValue(sessionCookie, out clientContext))
{
if (credential == null)
{
return null;
}
_sessions[sessionCookie] =
clientContext =
new NTAuthentication(false, "Ntlm", credential, spn, ContextFlagsPal.Connection, channelBindingToken);
}
string resp = clientContext.GetOutgoingBlob(challenge);
if (!clientContext.IsCompleted)
{
return new Authorization(resp, false);
}
else
{
_sessions.Remove(sessionCookie);
return new Authorization(resp, true);
}
}
}
// From reflected type NTAuthentication in System.Net.Security.
catch (NullReferenceException)
{
return null;
}
finally
{
if (NetEventSource.IsEnabled) NetEventSource.Exit(this, "Authenticate");
}
}