public void TestNegotiate() { using (WindowsCredentialsHandle handle = new WindowsCredentialsHandle( string.Empty, Secur32.SECPKG_CRED_OUTBOUND, "Negotiate")) { Assert.AreNotEqual(handle.Handle, Secur32.SecHandle.Zero); } }
public void TestNegotiate() { string package = "Negotiate"; using (WindowsCredentialsHandle credentialsHandle = new WindowsCredentialsHandle( string.Empty, Secur32.SECPKG_CRED_OUTBOUND, package)) { using (WindowsSecurityContext context = new WindowsSecurityContext( WindowsIdentity.GetCurrent().Name, credentialsHandle, package, Secur32.ISC_REQ_CONNECTION, Secur32.SECURITY_NATIVE_DREP)) { Assert.AreNotEqual(context.Context, Secur32.SecHandle.Zero); Assert.IsNotNull(context.Token); Assert.IsNotEmpty(context.Token); Console.WriteLine(Convert.ToBase64String(context.Token)); } } }