public async Task ValidSessionCookie(TestConfig config)
        {
            var cookie = await config.CreateSessionCookieAsync();

            var auth = config.CreateAuth();

            var decoded = await auth.VerifySessionCookieAsync(cookie);

            config.AssertFirebaseToken(decoded);
        }
Esempio n. 2
0
        public async Task ValidToken(TestConfig config)
        {
            var idToken = await config.CreateIdTokenAsync();

            var auth = config.CreateAuth();

            var decoded = await auth.VerifyIdTokenAsync(idToken);

            config.AssertFirebaseToken(decoded);
        }
        public async Task ValidSessionCookieWithClaims(TestConfig config)
        {
            var payload = new Dictionary <string, object>()
            {
                { "foo", "bar" },
            };
            var cookie = await config.CreateSessionCookieAsync(payloadOverrides : payload);

            var auth = config.CreateAuth();

            var decoded = await auth.VerifySessionCookieAsync(cookie);

            config.AssertFirebaseToken(decoded, payload);
        }
Esempio n. 4
0
        public async Task EmulatorIncorrectAlgorithm(TestConfig config)
        {
            var header = new Dictionary <string, object>()
            {
                { "alg", "HS256" },
            };
            var idToken = await config.CreateIdTokenAsync(headerOverrides : header);

            var auth = config.CreateAuth();

            var decoded = await auth.VerifyIdTokenAsync(idToken);

            config.AssertFirebaseToken(decoded);
        }
Esempio n. 5
0
        public async Task EmulatorNoKid(TestConfig config)
        {
            var header = new Dictionary <string, object>()
            {
                { "kid", string.Empty },
            };
            var idToken = await config.CreateIdTokenAsync(headerOverrides : header);

            var auth = config.CreateAuth();

            var decoded = await auth.VerifyIdTokenAsync(idToken);

            config.AssertFirebaseToken(decoded);
        }
        public async Task IssuedAtInAcceptableRange(TestConfig config)
        {
            var issuedAtSeconds = JwtTestUtils.Clock.UnixTimestamp() + ClockSkewSeconds;
            var payload         = new Dictionary <string, object>()
            {
                { "iat", issuedAtSeconds },
            };
            var cookie = await config.CreateSessionCookieAsync(payloadOverrides : payload);

            var auth = config.CreateAuth();

            var decoded = await auth.VerifySessionCookieAsync(cookie);

            config.AssertFirebaseToken(decoded, payload);
        }
Esempio n. 7
0
        public async Task ExpiryTimeInAcceptableRange(TestConfig config)
        {
            var expiryTimeSeconds = JwtTestUtils.Clock.UnixTimestamp() - ClockSkewSeconds;
            var payload           = new Dictionary <string, object>()
            {
                { "exp", expiryTimeSeconds },
            };
            var idToken = await config.CreateIdTokenAsync(payloadOverrides : payload);

            var auth = config.CreateAuth();

            var decoded = await auth.VerifyIdTokenAsync(idToken);

            config.AssertFirebaseToken(decoded, payload);
        }