Class FirebaseCredentialProvider
Resolves Firebase credentials from:
Explicit JSON path (credentialPath argument, else )
GOOGLE_APPLICATION_CREDENTIALS env var (Application Default Credentials)
Emulator env vars — FIRESTORE_EMULATOR_HOST (Firestore),
STORAGE_EMULATOR_HOST (Storage) — via .
Firebase apps are created as NAMED instances (never the process-global [DEFAULT]),
so the connector coexists with a host that initialized Firebase Admin SDK itself, and one
process can serve several service accounts. Apps are cached per
(credentialPath, projectId), Firestore clients per (projectId, credentialPath),
storage clients per credentialPath. Thread-safe.
Public so a named instance can be put into the context registry and referenced from
endpoint URIs via connectionFactory=…:
context.AddToRegistry("myFirebase", new FirebaseCredentialProvider
{
DefaultProjectId = "my-project",
DefaultCredentialPath = "/secrets/firebase-sa.json",
});
// fstore://orders?connectionFactory=myFirebase
public sealed class FirebaseCredentialProvider : IFirebaseCredentialProvider, IDisposable
Inheritance
Implements
Properties
DefaultCredentialPath
Service-account JSON path used when the endpoint does not specify one.
public string? DefaultCredentialPath { get; init; }
DefaultProjectId
Project ID used when the endpoint does not specify one.
public string? DefaultProjectId { get; init; }
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetFirestoreDb(string?, string?, string?)
Gets a for the specified project. Clients are cached per
public FirestoreDb GetFirestoreDb(string? projectId = null, string? credentialPath = null, string? databaseId = null)
GetOrCreateApp(string?, string?)
Gets or creates a using the specified credentials.
public FirebaseApp GetOrCreateApp(string? credentialPath = null, string? projectId = null)
GetStorageClient(string?)
Gets a . Clients are cached per credentialPath.
public StorageClient GetStorageClient(string? credentialPath = null)
GetUrlSigner(string?)
Gets a for signed download URLs. Requires a service-account
public UrlSigner GetUrlSigner(string? credentialPath = null)