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
PR switches authentication from Shibboleth to Okta and addresses some problems that happened when I cloned the repo to install the application.
The development, staging, and production apps were created for MClassrooms in the Application Management and Provisioning (AMP) Application, and generated metadata was used to update the devise initializer and credentials file.
Test signing in on localhost can be done now; the staging and production servers can be tested after the PR is merged.
What else was changed in this PR?
I cloned the lsa_evaluate repo to have a clean installation of the application.
I got the following error when starting the Rails console:
bin/rails c
Loading development environment (Rails 8.1.3.1)
Sorry, you can't use Pry without Readline or a compatible library.
* Use the rb-readline gem, which is a pure-Ruby port of Readline
Adding the pry gem and updating the pry-rails gem fixed the problem
Okta Attributes Released has a displayName attribute but no name attribute. The following files were edited to address the change:
Preserve RelayState runtime mapping for deep-link redirects
config/initializers/devise.rb:308
This removes the existing idp_sso_service_url_runtime_params: { origin: :RelayState } mapping. Both login buttons pass saml_authorize_params, and ApplicationController#after_sign_in_path_for relies on the resulting RelayState to restore encrypted deep links; without this mapping, users who start from a private/deep link lose that destination after Okta login and fall back to the default path. Retain the runtime-parameter mapping.
Restore RelayState mapping for deep-link redirects
config/initializers/devise.rb:310
saml_authorize_params sends the encrypted deep-link in an origin request parameter, but the new options no longer map that parameter to SAML RelayState. As a result, the IdP callback will not carry the /c/:token (or other deep-link) destination and after_sign_in_path_for falls back to the default dashboard/root path. Restore the runtime parameter mapping used by the previous configuration.
Preserve 10-second SAML clock drift tolerance
config/initializers/devise.rb:314
The previous configuration explicitly allowed 10 seconds of SAML clock skew, but this rewrite removes allowed_clock_drift. ruby-saml defaults this tolerance to zero, so ordinary small clock differences between the app and Okta can make otherwise valid assertions fail their time validation. Keep the existing 10-second tolerance (or replace it with an explicitly chosen nonzero value).
Preserve RelayState origin mapping for deep-link redirects
config/initializers/devise.rb:310
This removes the runtime mapping that carries the origin parameter from the sign-in buttons into SAML RelayState. ApplicationController#after_sign_in_path_for relies on that opaque RelayState to restore session['user_return_to'] (including /c/:token invite links), so a deep-link login will now fall back to the role-based destination instead of returning to the requested page. Preserve the mapping here.
Preserve SAML clock drift allowance
config/initializers/devise.rb:314
The previous SAML configuration explicitly allowed 10 seconds of IdP/SP clock skew, but this replacement drops allowed_clock_drift. ruby-saml defaults this to zero, so normal clock differences can cause otherwise valid Okta assertions to be rejected for timestamp validation; retain the explicit allowance (or another reviewed value).
The previous SAML configuration mapped the origin query parameter to RelayState, but this replacement drops idp_sso_service_url_runtime_params. The login buttons still send the opaque return path via saml_authorize_params, so without this mapping the IdP will not return it and deep links such as contest invite URLs fall back to the default post-login page. Restore the runtime-parameter mapping here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
PR switches authentication from Shibboleth to Okta and addresses some problems that happened when I cloned the repo to install the application.
Test signing in on localhost can be done now; the staging and production servers can be tested after the PR is merged.
I cloned the lsa_evaluate repo to have a clean installation of the application.
Adding the pry gem and updating the pry-rails gem fixed the problem
app/controllers/users/omniauth_callbacks_controller.rb
config/initializers/devise.rb
spec/requests/users/omniauth_callbacks_spec.rb
spec/support/auth_helpers.rb