You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OmniAuth Setup Phase[1] allows for "request-time modification of an
OmniAuth strategy". We're intending to use this in Experience CS so that
we can optionally include the `student` scope[2] to allow students to
login.
The Profile app uses the presence of the `student` scope in the login
request to decide whether to display the student login form (i.e. the
form containing the school code textbox). We want to allow students (as
well as non-students) to login to Experience CS and so need a way of
changing the `scope` accordingly. By default the `scope` is fixed at
Rails initialization time in the `RpiAuth::Engine`[3] but we need to be
able to toggle it at runtime depending on whether user is a student or
not. By utilising OmniAuth's setup phase[2] we can toggle the `scope`
based on something we set in the app (e.g. we might set something in the
session to indicate that we want the student login flow).
I initially added logic in this Gem to add the `student` scope if a
specific value was set in the session but later decided that it should
be up to the consuming apps to use this `setup` phase as they see fit.
[1]: https://github.com/omniauth/omniauth/wiki/Setup-Phase
[2]: https://github.com/RaspberryPiFoundation/documentation/blob/a92f03446a347d2d1acea48c50ea37f15293a9b6/docs/technology/codebases-and-products/accounts/profile-app/custom-oidc-scopes.md#available-custom-scopes
[3]: https://github.com/RaspberryPiFoundation/rpi-auth/blob/b7771ee120254e4c6f2d90c5025be5714daeb542/lib/rpi_auth/engine.rb#L31
0 commit comments