Beispiel #1
0
        public void EnsureAllClaimDescriptorsAreReturnedByTheCreator()
        {
            var creator = new IdentityCreator();

            var creatorClaims = creator.Create("*****@*****.**", "*****@*****.**", "octopus\test", "Test User");

            Assert.AreEqual("*****@*****.**", creatorClaims.Claims[ClaimDescriptor.EmailClaimType].Value);
            Assert.AreEqual("*****@*****.**", creatorClaims.Claims[IdentityCreator.UpnClaimType].Value);
            Assert.AreEqual("octopus\test", creatorClaims.Claims[IdentityCreator.SamAccountNameClaimType].Value);
            Assert.AreEqual("Test User", creatorClaims.Claims[ClaimDescriptor.DisplayNameClaimType].Value);
        }
Beispiel #2
0
        public void EnsureAllClaimDescriptorsAreReturnedByTheProvider()
        {
            var provider = new DirectoryServicesAuthenticationProvider(null);
            var creator  = new IdentityCreator();

            var creatorClaims = creator.Create("*****@*****.**", "*****@*****.**", "octopus\test", "Test User");
            var metadata      = provider.GetMetadata();

            var missingClaims = creatorClaims.Claims.Where(c => !c.Value.IsServerSideOnly && metadata.ClaimDescriptors.All(d => d.Type != c.Key)).ToArray();

            foreach (var missingClaim in missingClaims)
            {
                Console.WriteLine($"Missing claim type {missingClaim.Key}");
            }
            Assert.IsEmpty(missingClaims);
        }