hslavich / OneloginSamlBundle

OneLogin SAML Bundle for Symfony
MIT License
149 stars 94 forks source link

Dynamic configuration #32

Open VincentClair opened 8 years ago

VincentClair commented 8 years ago

Hello,

I succeeded in installing the bundle in our application and make it work with ADFS.

Now, we would like to enhance our features:

Maybe there is other idea to make the installation / process / bundle more flexible and fluid. Do you plan some similare improvements ?

By the while, the bundle is really great and it makes already our development easier. Thanks

hslavich commented 8 years ago

Hi Vincent, Thank you for your feedback, I really appreciate it.

Thanks

s-a-y commented 7 years ago

+1 for dynamic configuration

01e9 commented 7 years ago

+1

We have Clients that use our service and they need to configure (optionally) their IdP and a "Login with SAML" will appear on their subdomain. There is no central IdP, the config must be loaded depending on current subdomain.

~If you know a bundle that has this feature, please share.~

01e9 commented 7 years ago

LightSaml bundle did the job for me.

VincentClair commented 7 years ago

Thank you for the link, i will give it a try !

articque commented 6 years ago

In my application, the admin can choose to activate or not SSO. When he activates it, i change dynamically yml files in config folder and load Bundle in AppKernel.

I have 3 yml files for sso config.

These 3 files are empty if sso is not activated and filled by code when sso is activated. These 3 files are always included by this way :

in routing.yml

import:
    resource: sso_routing.yml

in config.yml

imports:
  ...
    - { resource: sso_config.yml }
    - { resource: sso_security.yml }

When sso is activated the contents are :

in sso_routing.yml

hslavich_saml_sp:
    resource: '@HslavichOneloginSamlBundle/Resources/config/routing.yml'

in sso_config.yml

hslavich_onelogin_saml:
    idp:
        entityId: '...'
        singleSignOnService:
            .....
    sp:
        entityId: '...'
        assertionConsumerService:
            ....
    security:
        nameIdEncrypted: false
        ....

in sso_security.yml

security:
    firewalls:
        main:
            saml:
                username_attribute: username
                check_path: /saml/acs
                login_path: /saml/login
                failure_path: /login
                always_use_default_target_path: false
                user_factory: sso_user_factory
                persist_user: true
            logout:
                path: /saml/logout

To load dynamically Bundle in AppKernel.php, il read parameters.yml :

public function registerBundles()
{
  $paramYml = Yaml::parse(file_get_contents($this->getRootDir().'/config/parameters.yml'));
  $bundles = array( .... );
  if($paramYml['parameters']['sso_enabled'])
    $bundles[] = new Hslavich\OneloginSamlBundle\HslavichOneloginSamlBundle();
}

As you can see, i change the parameter "sso_enabled" in parameters.yml when the admin activates or not the sso.