Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetIdentity()

static IIdentity System.Net.Security.NegotiateStreamPal.GetIdentity ( NTAuthentication context)
inlinestaticpackage

Definition at line 12 of file NegotiateStreamPal.cs.

13 {
14 IIdentity identity = null;
15 string name = (context.IsServer ? context.AssociatedName : context.Spn);
16 string protocolName = context.ProtocolName;
17 if (context.IsServer)
18 {
19 SecurityContextTokenHandle token = null;
20 try
21 {
22 SecurityStatusPal status;
23 SafeDeleteContext context2 = context.GetContext(out status);
24 if (status.ErrorCode != SecurityStatusPalErrorCode.OK)
25 {
26 throw new Win32Exception((int)SecurityStatusAdapterPal.GetInteropFromSecurityStatusPal(status));
27 }
28 global::Interop.SECURITY_STATUS sECURITY_STATUS = (global::Interop.SECURITY_STATUS)SSPIWrapper.QuerySecurityContextToken(GlobalSSPI.SSPIAuth, context2, out token);
29 if (sECURITY_STATUS != 0)
30 {
31 throw new Win32Exception((int)sECURITY_STATUS);
32 }
33 string protocolName2 = context.ProtocolName;
34 return new WindowsIdentity(token.DangerousGetHandle(), protocolName2);
35 }
36 catch (SecurityException)
37 {
38 }
39 finally
40 {
41 token?.Dispose();
42 }
43 }
44 return new GenericIdentity(name, protocolName);
45 }

References System.Runtime.InteropServices.CriticalHandle.Dispose(), System.Net.SecurityStatusPal.ErrorCode, System.Net.NTAuthentication.GetContext(), System.Net.SecurityStatusAdapterPal.GetInteropFromSecurityStatusPal(), System.Net.NTAuthentication.IsServer, System.Net.NTAuthentication.ProtocolName, System.Net.SSPIWrapper.QuerySecurityContextToken(), System.Net.NTAuthentication.Spn, and System.Net.GlobalSSPI.SSPIAuth.