internal static FirebaseTokenVerifier CreateIDTokenVerifier(FirebaseApp app)
        {
            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 = new FirebaseTokenVerifierArgs()
            {
                ProjectId       = projectId,
                ShortName       = "ID token",
                Operation       = "VerifyIdTokenAsync()",
                Url             = "https://firebase.google.com/docs/auth/admin/verify-id-tokens",
                Issuer          = "https://securetoken.google.com/",
                Clock           = SystemClock.Default,
                PublicKeySource = keySource,
            };

            return(new FirebaseTokenVerifier(args));
        }
示例#2
0
        internal static FirebaseTokenVerifier CreateIDTokenVerifier(FirebaseApp app)
        {
            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 = FirebaseTokenVerifierArgs.ForIdTokens(projectId, keySource);

            return(new FirebaseTokenVerifier(args));
        }