-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
[Question] MultiTenancy without stores? #805
Comments
Hi, I see what you mean. I recommend a very basic store that does nothing but implement |
Thanks for the quick reply. Your suggestion works for me 👍 For anyone coming across this issue, I've implemented the store like this: public sealed class KeycloakTenantStore : IMultiTenantStore<TenantInfo>
{
public async Task<TenantInfo?> TryGetByIdentifierAsync(string identifier)
=> await Task.FromResult(new TenantInfo { Id = identifier, Identifier = identifier, });
public async Task<TenantInfo?> TryGetAsync(string id)
=> await Task.FromResult(new TenantInfo { Id = id, Identifier = id, });
public Task<bool> TryAddAsync(TenantInfo tenantInfo)
=> throw new NotImplementedException();
public Task<bool> TryUpdateAsync(TenantInfo tenantInfo)
=> throw new NotImplementedException();
public Task<bool> TryRemoveAsync(string identifier)
=> throw new NotImplementedException();
public Task<IEnumerable<TenantInfo>> GetAllAsync()
=> throw new NotImplementedException();
} The issue can be closed in my opinion. |
Nice. It might make sense to add this to the library for testing and certain use cases. Would you be up for submitting it as a PR? |
@AndrewTriesToCode, sure. How would you like me to call this new 'store'? |
Hi, adding the store to the Finbuckle.MultiTenant stores folder, adding an extension method to MultiTenantBuilder and adding a short section to the stores Docs is what I’d recommend. I think calling it the Echo store makes sense— just gives back what you put in. |
Hey @AndrewTriesToCode, I’m relatively new to this library and I’m enjoying it so far, but I have a question: Is it somehow possible to implement MultiTenancy without specifying/implementing any stores?
I’m using Keycloak to specify my tenants (realms). I’ve already implemented the authentication part (custom) and I’m not trying to use ‘WithPerTenantAuthentication’ here. The tenant name/identifier can be retrieved from the token, so that’ll be my strategy.
As for the TenantInfo, I just need one with the id/identifier set to this claim value, without any additional settings. I don’t really like having to specify all the different tenant names in the config. Hence the question.
So again, is it somehow possible to have a sort of ‘tenant resolver’ that returns a Tenant with the id/identifier set to a value in a token, without having to specify/configure a store?
I hope this makes sense, thanks!
The text was updated successfully, but these errors were encountered: