Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SmtpNtlmAuthenticationModule.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
using
System.Security.Authentication.ExtendedProtection
;
3
4
namespace
System.Net.Mail
;
5
6
internal
sealed
class
SmtpNtlmAuthenticationModule
:
ISmtpAuthenticationModule
7
{
8
private
readonly
Dictionary
<object,
System
.
Net
.
NTAuthentication
>
_sessions
=
new
Dictionary
<object,
System
.
Net
.
NTAuthentication
>();
9
10
public
string
AuthenticationType
=>
"ntlm"
;
11
12
internal
SmtpNtlmAuthenticationModule
()
13
{
14
}
15
16
public
Authorization
Authenticate
(
string
challenge
,
NetworkCredential
credential
,
object
sessionCookie
,
string
spn
,
ChannelBinding
channelBindingToken
)
17
{
18
try
19
{
20
lock
(
_sessions
)
21
{
22
if
(!
_sessions
.
TryGetValue
(
sessionCookie
,
out
var
value
))
23
{
24
if
(
credential
==
null
)
25
{
26
return
null
;
27
}
28
value
= (
_sessions
[
sessionCookie
] =
new
System
.
Net
.
NTAuthentication
(
isServer
:
false
,
"Ntlm"
,
credential
,
spn
,
System
.
Net
.ContextFlagsPal.Connection,
channelBindingToken
));
29
}
30
string
outgoingBlob
=
value
.GetOutgoingBlob(
challenge
);
31
if
(!
value
.IsCompleted)
32
{
33
return
new
Authorization
(
outgoingBlob
,
finished
:
false
);
34
}
35
_sessions
.
Remove
(
sessionCookie
);
36
return
new
Authorization
(
outgoingBlob
,
finished
:
true
);
37
}
38
}
39
catch
(
NullReferenceException
)
40
{
41
return
null
;
42
}
43
}
44
45
public
void
CloseContext
(
object
sessionCookie
)
46
{
47
}
48
}
System.Collections.Generic.Dictionary.TryGetValue
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
Definition
Dictionary.cs:1419
System.Collections.Generic.Dictionary.Remove
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
Definition
Dictionary.cs:893
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Net.Authorization
Definition
Authorization.cs:4
System.Net.Mail.SmtpNtlmAuthenticationModule._sessions
readonly Dictionary< object, System.Net.NTAuthentication > _sessions
Definition
SmtpNtlmAuthenticationModule.cs:8
System.Net.Mail.SmtpNtlmAuthenticationModule.Authenticate
Authorization Authenticate(string challenge, NetworkCredential credential, object sessionCookie, string spn, ChannelBinding channelBindingToken)
Definition
SmtpNtlmAuthenticationModule.cs:16
System.Net.Mail.SmtpNtlmAuthenticationModule.SmtpNtlmAuthenticationModule
SmtpNtlmAuthenticationModule()
Definition
SmtpNtlmAuthenticationModule.cs:12
System.Net.Mail.SmtpNtlmAuthenticationModule.AuthenticationType
string AuthenticationType
Definition
SmtpNtlmAuthenticationModule.cs:10
System.Net.Mail.SmtpNtlmAuthenticationModule.CloseContext
void CloseContext(object sessionCookie)
Definition
SmtpNtlmAuthenticationModule.cs:45
System.Net.Mail.SmtpNtlmAuthenticationModule
Definition
SmtpNtlmAuthenticationModule.cs:7
System.Net.NTAuthentication
Definition
NTAuthentication.cs:10
System.Net.NetworkCredential
Definition
NetworkCredential.cs:8
System.NullReferenceException
Definition
NullReferenceException.cs:9
System.Security.Authentication.ExtendedProtection.ChannelBinding
Definition
ChannelBinding.cs:6
System.Net.Mail.ISmtpAuthenticationModule
Definition
ISmtpAuthenticationModule.cs:6
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Net.Mail
Definition
AlternateView.cs:5
System.Net.HttpRequestHeader.Authorization
@ Authorization
System.Net
Definition
HttpClientJsonExtensions.cs:8
System.Security.Authentication.ExtendedProtection
Definition
ExtendedProtectionPolicyTypeConverter.cs:8
System.ExceptionArgument.value
@ value
System
Definition
BlockingCollection.cs:8
source
System.Net.Mail
System.Net.Mail
SmtpNtlmAuthenticationModule.cs
Generated by
1.10.0