Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom url for get token public keys #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions FirebaseAdmin/FirebaseAdmin/AppOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ internal AppOptions(AppOptions options)
this.ProjectId = options.ProjectId;
this.ServiceAccountId = options.ServiceAccountId;
this.HttpClientFactory = options.HttpClientFactory;
this.TokenCertUrl = options.TokenCertUrl;
}

/// <summary>
Expand Down Expand Up @@ -66,5 +67,10 @@ internal AppOptions(AppOptions options)
/// Gets or sets the HttpClientFactory to use when making Firebase requests.
/// </summary>
public HttpClientFactory HttpClientFactory { get; set; }

/// <summary>
/// Gets or sets the TokenCertUrl to use custom public key url.
/// </summary>
public string TokenCertUrl { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ internal static FirebaseTokenVerifier CreateIdTokenVerifier(
"Must initialize FirebaseApp with a project ID to verify ID tokens.");
}

var tokenCertUrl = string.IsNullOrEmpty(app.Options.TokenCertUrl)
? IdTokenCertUrl
: app.Options.TokenCertUrl;
var keySource = new HttpPublicKeySource(
IdTokenCertUrl, SystemClock.Default, app.Options.HttpClientFactory);
tokenCertUrl, SystemClock.Default, app.Options.HttpClientFactory);
var args = CreateIdTokenVerifierArgs();
args.ProjectId = projectId;
args.TenantId = tenantId;
Expand Down