Example #1
0
 public void LsaConnectUntrusted()
 {
     using (var interop = LsaInterop.Connect())
     {
         Assert.IsNotNull(interop);
     }
 }
Example #2
0
 // This test requires Windows TCB to operate which only happens when running as SYSTEM
 // As such this is a manual test that should only be when the environment is set up correctly
 //
 // [TestMethod]
 public static void LsaConnectTrusted()
 {
     using (var interop = LsaInterop.RegisterLogonProcess("KerbNetTests"))
     {
         Assert.IsNotNull(interop);
     }
 }
Example #3
0
        public void LsaImportCredential()
        {
            var cred = CreateKrbCredential();

            using (var interop = LsaInterop.Connect())
            {
                Assert.IsNotNull(interop);

                interop.ImportCredential(cred);
            }
        }
Example #4
0
        public void LsaImportSspiIsc()
        {
            var cred = CreateKrbCredential();

            using (var interop = LsaInterop.Connect())
            {
                Assert.IsNotNull(interop);

                interop.ImportCredential(cred);

                RetrieveAndVerifyTicket();
            }
        }
Example #5
0
        public async Task LsaLogonUserImportUseCache()
        {
            var cred   = CreateKrbCredential();
            var config = Krb5Config.Default();

            using (var interop = LsaInterop.Connect())
            {
                Assert.IsNotNull(interop);

                interop.LogonUser();

                interop.ImportCredential(cred);

                using (var client = new KerberosClient(config)
                {
                    Cache = new LsaCredentialCache(config, interop)
                })
                {
                    var ticket = await client.GetServiceTicket(RequestedSpn);

                    Assert.IsNotNull(ticket);
                }
            }
        }
Example #6
0
 public LsaCredentialCache(Krb5Config config, LsaInterop lsa = null, ILoggerFactory logger = null)
     : base(config, logger)
 {
     this.lsa = lsa ?? LsaInterop.Connect();
 }