handnot2 / samly

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

Samly.State.Store.get_assertion can actually get nil instead of assertion_key() #50

Open aliaksandr-martsinovich opened 4 years ago

aliaksandr-martsinovich commented 4 years ago

Samly.State.Store.get_assetion's typespec is get_assertion(Conn.t(), assertion_key(), opts()) :: Assertion.t() | nil

But here we supply the function with the result of get_session(conn, "samly_assertion_key") which will return nil if "samly_assertion_key" key is not set.

I think this happens for the very first login attempt and obviously results in an exception.