handnot2 / samly

Elixir Plug library to enable SAML 2.0 SP SSO in Phoenix/Plug applications.
MIT License
125 stars 90 forks source link

Dynamically adding identity providers #29

Open jhchen opened 5 years ago

jhchen commented 5 years ago

Is there a recommended way to add identity providers at runtime? Currently we are doing Application.put_env(:samly, :identity_providers, identity_providers) and generating identity_providers from IdpData.load_providers/1 which doesn't feel like the cleanest since it has to re-generate existing identity providers.

Happy to contribute a PR if there is interest supporting an API to add a new identity provider at runtime. The use case for us is we allow users to integrate their Okta organization so different users Okta accounts ex. company1.okta.com and company2.okta.com which would correspond to company1.slab.com and company2.slab.com on our end. These would have different metadata XML files that we would add during runtime.

handnot2 commented 5 years ago

The current config/metadata XML-in-files model may not be suitable in that dynamic world. I was thinking of addressing such a requirement after the 1.0 release.

A PR that could move Samly in that direction would be welcome.

jhchen commented 5 years ago

Okay yes we are actually doing a hacky JIT writing to file right now but maybe we can just start with this. Will try to find some time in the next couple of weeks.

kanes115 commented 5 years ago

@jhchen @handnot2 is there any progress on this?

tielur commented 4 years ago

I'm interested in this as well. I'm wondering if we can follow something similar that was done for the State where a behaviour is written. The first implementation could be a Config version where it does what Samly currently does now reading from the application environment.

Then we can build other implementations on top of that, such as databases, ets, ect...

@handnot2 thoughts?