Exemple #1
0
        internal static FirebaseTokenVerifier CreateSessionCookieVerifier(FirebaseApp app)
        {
            var projectId = app.GetProjectId();

            if (string.IsNullOrEmpty(projectId))
            {
                throw new ArgumentException(
                          "Must initialize FirebaseApp with a project ID to verify session cookies.");
            }

            var keySource = new HttpPublicKeySource(
                SessionCookieCertUrl, SystemClock.Default, app.Options.HttpClientFactory);

            return(CreateSessionCookieVerifier(projectId, keySource));
        }
        internal static FirebaseTokenVerifier CreateIdTokenVerifier(
            FirebaseApp app, string tenantId = null)
        {
            var projectId = app.GetProjectId();

            if (string.IsNullOrEmpty(projectId))
            {
                throw new ArgumentException(
                          "Must initialize FirebaseApp with a project ID to verify ID tokens.");
            }

            var keySource = new HttpPublicKeySource(
                IdTokenCertUrl, SystemClock.Default, app.Options.HttpClientFactory);
            var args = CreateIdTokenVerifierArgs();

            args.ProjectId       = projectId;
            args.TenantId        = tenantId;
            args.PublicKeySource = keySource;
            args.IsEmulatorMode  = Utils.IsEmulatorModeFromEnvironment;
            return(new FirebaseTokenVerifier(args));
        }