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

[Question] How to handle multi-tenancy? #246

Open
gopalkriagg opened this issue Jun 10, 2021 · 1 comment
Open

[Question] How to handle multi-tenancy? #246

gopalkriagg opened this issue Jun 10, 2021 · 1 comment

Comments

@gopalkriagg
Copy link

First of all, thank you for making such a great package!!

The Laravel application that I work on serves multiple companies (tenants) and each of these companies get a unique subdomain. So, all the requests coming from a tenant have their unique subdomain attached to the request URL. Now, we are creating a feature which will allow each of these companies to configure an IdP if they want to use SAML feature. I was thinking that we will allow the admins of each tenant to configure such settings from admin panel and these settings will be stored in the SQL database in saml_settings table which will have one to one relationship with tenants table.

But since the settings are picked from <idpName>_idp_settings.php and not from the database I am not sure how to configure this. I don't want to add a new <idpName>_idp_settings.php file and then release the app, whenever a new tenant wants to use this feature.

Sorry for such a long explanation.

I have looked around in the issues of this repo but couldn't find the exact answer that I am looking for. Please help.

@nbyloff
Copy link

nbyloff commented Sep 14, 2021

I was looking for the same thing, but it's coded for file based configs only.

I don't have a lot of idp(s) expected so I will just use config files, but you could try using a ServiceProvider to load idp settings into the config directly to match this packages expected format. Something like...

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot() 
{
  $all = SamlSetting::all();
  foreach ($all as $setting) {
    config([
        ''saml2.'.$setting->idpName.'_idp_settings'' => ['key' => 'value']
      ]);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants