示例#1
0
        public static JwtSecurityToken CreateJwtSecurityToken(string issuer = null, string originalIssuer = null)
        {
            string iss         = issuer ?? Default.Issuer;
            string originalIss = originalIssuer ?? Default.OriginalIssuer;

            return(new JwtSecurityToken(issuer, "http://www.contoso.com", ClaimSets.Simple(iss, originalIss)));
        }
示例#2
0
        public void CompareJwtPayload()
        {
            TestUtilities.WriteHeader($"{this}.CompareJwtPayload", true);
            var context     = new CompareContext($"{this}.CompareJwtPayload");
            var jwtPayload1 = new JwtPayload(ClaimSets.DefaultClaimsAsCreatedInPayload());
            var jwtPayload2 = new JwtPayload();

            IdentityComparer.AreEqual(jwtPayload1, jwtPayload2, context);

            Assert.True(context.Diffs.Count(s => s == "Aud:") == 1);
            Assert.True(context.Diffs.Count(s => s == "Claims:") == 1);
        }