Allow OmniAuth Setup Phase to be configured #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The OmniAuth Setup Phase 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 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 thescope
accordingly. By default thescope
is fixed at Rails initialization time in theRpiAuth::Engine
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 we can toggle thescope
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 thissetup
phase as they see fit.