public void ToJavaScriptObject_sets_exp_for_1_hour_by_default()
        {
            var claimSet = new JsonWebTokenClaimSet();

            dynamic jsObject        = claimSet.ToJavaScriptObject();
            var     expectedSeconds = Convert.ToInt64(DateTime.UtcNow.Add(TimeSpan.FromHours(1)).Subtract(UnixEpoch).TotalSeconds);

            Assert.That(jsObject.exp, Is.InRange(expectedSeconds - 2, expectedSeconds + 2));
        }
        public void ToJavaScriptObject_sets_iat()
        {
            var claimSet = new JsonWebTokenClaimSet();

            dynamic jsObject        = claimSet.ToJavaScriptObject();
            var     expectedSeconds = Convert.ToInt64(DateTime.UtcNow.Subtract(UnixEpoch).TotalSeconds);

            Assert.That(jsObject.iat, Is.InRange(expectedSeconds - 2, expectedSeconds + 2));
        }
        public void ToJavaScriptObject_sets_aud()
        {
            var claimSet = new JsonWebTokenClaimSet
            {
                Audience = new Uri("http://localhost")
            };

            dynamic jsObject = claimSet.ToJavaScriptObject();

            Assert.That(jsObject.aud, Is.EqualTo("http://localhost/"));
        }
        public void ToJavaScriptObject_sets_iss()
        {
            var claimSet = new JsonWebTokenClaimSet
            {
                Issuer = "My issuer"
            };

            dynamic jsObject = claimSet.ToJavaScriptObject();

            Assert.That(jsObject.iss, Is.EqualTo("My issuer"));
        }
        public void ToJavaScriptObject_sets_scope()
        {
            var claimSet = new JsonWebTokenClaimSet
            {
                Scopes =
                {
                    "scope1",
                    "scope2",
                    "scope3"
                }
            };

            dynamic jsObject = claimSet.ToJavaScriptObject();

            Assert.That(jsObject.scope, Is.EqualTo("scope1 scope2 scope3"));
        }