Ejemplo n.º 1
0
        public async Task KrbCredImportsAndGets()
        {
            var krbCred = CreateKrbCredential();

            using (var client = new KerberosClient())
            {
                client.ImportCredential(krbCred);

                var serviceTicket = await client.GetServiceTicket("host/test.com");

                Assert.IsNotNull(serviceTicket);
                Assert.IsNotNull(serviceTicket.Authenticator);
                Assert.IsNotNull(serviceTicket.Ticket);
            }
        }
Ejemplo n.º 2
0
        public async Task KrbCredImportsAndPassesAuthenticatorValidation()
        {
            var krbCred = CreateKrbCredential();

            using (var client = new KerberosClient())
            {
                client.ImportCredential(krbCred);

                var serviceTicket = await client.GetServiceTicket("host/test.com");

                Assert.IsNotNull(serviceTicket);

                var encodedTicket = "Negotiate " + Convert.ToBase64String(serviceTicket.EncodeGssApi().ToArray());

                var authenticator = new KerberosAuthenticator(new KeyTable(new KerberosKey(new byte[16], etype: EncryptionType.AES128_CTS_HMAC_SHA1_96)));

                var result = await authenticator.Authenticate(encodedTicket);

                Assert.IsNotNull(result);
                Assert.AreEqual("*****@*****.**", result.Name);
            }
        }