OTA-Insight / djangosaml2idp

SAML 2.0 Identity Provider in Django
Apache License 2.0
104 stars 96 forks source link

Multiple saml integrations with the same entity ID #123

Open lgarvey opened 3 years ago

lgarvey commented 3 years ago

I have a dilemma: I need to integrate with multiple AWS services via IdP initiated Saml. Unfortunately, AWS has a single entity ID for all services so I need a way of having two ServiceProvider entries with the same entity_id.

This was solved previously by overriding the relevant djangosaml2idp.views and supporting an sp alias e.g

https://github.com/uktrade/staff-sso/blob/master/config/settings.py#L468-L484

https://github.com/uktrade/staff-sso/blob/master/sso/samlidp/views.py#L141-L144

However, it'd be great if I could modify the djangosaml2idp package to avoid having to override entire blocks of code.

I'm wondering if a field on the ServiceProvider model -- e.g. aliased_entity_id or real_entity_id or something -- which if present takes precedence over the entity_id field, might work.

This would then enable ?sp=some-alias, e.g.

/idp/sso/init?sp=aws-quicksight

What do you think?