firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
370 stars 131 forks source link

Any updates on multi-tenancy #149

Closed mirkarpude closed 4 years ago

mirkarpude commented 4 years ago

Authenticating with multi-tenancy

hiranya911 commented 4 years ago

Unless we get some contributions from the community, I don't expect it to happen in the near future.

moander commented 4 years ago

See #152

Usage:

var auth = FirebaseAuth.DefaultInstance.TenantManager.AuthForTenant("my-tenant-id");

@hiranya911 FirebaseAuth and TenantAwareFirebaseAuth classes inherit AbstractFirebaseAuth.

I decided to have both TenantManager and TenantId properties in AbstractFirebaseAuth instead of FirebaseAuth so the public API is currently exactly the same except for static members.

TenantManager has one function AuthForTenant. In the future the manager will also contain admin functions for managing tenants.

hiranya911 commented 4 years ago

Based on the API signatures we've come for the Java SDK:

class AbstractFirebaseAuth {
  // All existing methods in FirebaseAuth
}

class FirebaseAuth : AbstractFirebaseAuth {
  TenantManager TenantManager { get; }
}

class TenantAwareFirebaseAuth : AbstractFirebaseAuth {

}

class TenantManager {
  TenantAwareFirebaseAuth AuthForTenant(string tenantId);
  Task<Tenant> GetTenantAsync(string tenantId);
  Task<Tenant> CreateTenantAsync(TenantArgs args);
  Task<Tenant> UpdateTenantAsync(TenantArgs args);
  Task DeleteTanantAsync(string tenantId);
  PagedAsyncEnumerable<Tenants, Tenant> ListTenantsAsync(ListTenantsOptions options);
}

class Tenant {
  string TenantId { get; }
  string DisplayName { get; }
  boolean PasswordSignUpAllowed { get; }
  boolean EmailLinkSignInEnabled { get; }
}
nathan-c commented 4 years ago

It looks like #152 is nearly done but hasn't been touched since Feb. It would be great to get this merged if possible as it is useful functionality to have in the dotnet SDK.

hiranya911 commented 4 years ago

152 is incomplete and has many gaps. It cannot be merged in its present state.