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

◆ AcquireCredentialsHandle() [4/4]

static SafeFreeCredentials System.Net.Security.NegotiateStreamPal.AcquireCredentialsHandle ( string package,
bool isServer,
NetworkCredential credential )
inlinestaticpackage

Definition at line 207 of file NegotiateStreamPal.cs.

208 {
209 SafeSspiAuthDataHandle authData = null;
210 try
211 {
212 global::Interop.SECURITY_STATUS sECURITY_STATUS = global::Interop.SspiCli.SspiEncodeStringsAsAuthIdentity(credential.UserName, credential.Domain, credential.Password, out authData);
213 if (sECURITY_STATUS != 0)
214 {
215 if (System.Net.NetEventSource.Log.IsEnabled())
216 {
217 System.Net.NetEventSource.Error(null, System.SR.Format(System.SR.net_log_operation_failed_with_error, "SspiEncodeStringsAsAuthIdentity", $"0x{sECURITY_STATUS:X}"), "AcquireCredentialsHandle");
218 }
219 throw new Win32Exception((int)sECURITY_STATUS);
220 }
221 return SSPIWrapper.AcquireCredentialsHandle(GlobalSSPI.SSPIAuth, package, isServer ? global::Interop.SspiCli.CredentialUse.SECPKG_CRED_INBOUND : global::Interop.SspiCli.CredentialUse.SECPKG_CRED_OUTBOUND, ref authData);
222 }
223 finally
224 {
225 authData?.Dispose();
226 }
227 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_log_operation_failed_with_error
Definition SR.cs:154
Definition SR.cs:7

References System.Net.SSPIWrapper.AcquireCredentialsHandle(), System.Runtime.InteropServices.SafeHandle.Dispose(), System.Net.NetworkCredential.Domain, System.Net.NetEventSource.Error(), System.SR.Format(), System.Net.NetEventSource.Log, System.SR.net_log_operation_failed_with_error, System.Net.NetworkCredential.Password, System.Net.GlobalSSPI.SSPIAuth, and System.Net.NetworkCredential.UserName.