handnot2 / samly

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

add idp_id to Assertion prior to piping through pre_session_create_pipeline #45

Closed jgautsch closed 5 years ago

jgautsch commented 5 years ago

I have a use-case where I'd like to access assertion.idp_id inside my pre_session_create_pipeline plug.

Presently idp_id is set on the assertion after the pre_session_create_pipeline plug is executed, so the plug sees %Assertion{idp_id: nil}. Here is the relevant code.

I suggest that idp_id be set on the Assertion struct prior to it being passed to the pre_session_create_pipeline.

Another way for me to accomplish this without code changes is to access conn.private[:samly_idp], which works fine, although the suggested change feels like a cleaner division between application code and library implementation details.

Thanks for a great package. I'm happy to submit a PR for this.

handnot2 commented 5 years ago

Thanks for the suggestion. It was a simple fix. Will roll this into a hex release along with a few other items.