Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE BRANCH - 407 Add SSO #498

Open
wants to merge 15 commits into
base: qa
Choose a base branch
from
Open

Conversation

Janell-Huyck
Copy link
Contributor

@Janell-Huyck Janell-Huyck commented May 10, 2024

This PR implements the following major changes for the Rails application:

Removed Devise

Completely removed Devise for session and account management.
Transitioned to custom-built methods for handling authentication, session management, and user access control.

Custom Session Handling

Introduced a SessionsController for managing user login and logout flows.
Sessions now rely on custom logic to authenticate users via Shibboleth SSO or development login pathways, depending on the environment.

Development Login Pathway

Added a 'Dev Login' page and button for testers and developers to log in during development and test environments.
Ensured the 'Dev Login' page is inaccessible in production for security purposes. Attempts to access it in production redirect users to the home page.

Shibboleth SSO Integration

  • Implemented Shibboleth as the primary authentication method for production.
  • Configured a Shibboleth callback to authenticate users and extract the username from headers provided by Shibboleth-SP.
  • Established the following behavior for user logins:
    • Redirect active users to conservation_records_path.
    • Restrict inactive users to root_path.

@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch from 1871fcd to 8b80f6a Compare May 10, 2024 14:37
@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch from c803915 to de1f643 Compare July 2, 2024 17:15
@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch from de1f643 to e3186a1 Compare July 11, 2024 17:31
@Janell-Huyck Janell-Huyck changed the title FEATURE BRANCH - 407 Add SSO WIP - FEATURE BRANCH - 407 Add SSO Jul 31, 2024
@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch 4 times, most recently from 89bbe48 to aa71118 Compare August 19, 2024 19:45
@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch from 9677157 to 9289c0c Compare September 12, 2024 17:22
Janell-Huyck and others added 4 commits October 17, 2024 08:46
… BRANCH (#532)

* Copy ucrate tests - first pass

* Add necessary gems

* reviewed test list

* files reviewed 51724

* reviewed tests and deleted or modified

* Test update 5/20

* LIBTREATDB-38 add sso configuration to environment variables (#528)

* LIBTREATDB-61 - Remove env variables (#529)

* Remove Shibboleth environment variables, comment out Shibboleth tests

* LIBTREATDB-61 link issue to Jira

* Copy ucrate tests - first pass

reviewed test list

LIBTREATDB-55 set up to use shibboleth with middleware (#530)

* Remove Shibboleth environment variables, comment out Shibboleth tests

* LIBTREATDB-61 link issue to Jira

* LIBTREATDB-55 Set up middleware to use Shibboleth

* LIBTREATDB-55 Rubocop fix

* WIP

* Revert "WIP"

This reverts commit 9a3987c.

* Re-run bundle install

* Upgrade to pagy 9

* Add test for callbacks controller

* Rubocop fix for new callbacks controller spec

LIBTREATDB-55 set up to use shibboleth with middleware (#530)

* Remove Shibboleth environment variables, comment out Shibboleth tests

* LIBTREATDB-61 link issue to Jira

* LIBTREATDB-55 Set up middleware to use Shibboleth

* LIBTREATDB-55 Rubocop fix

* WIP

* Revert "WIP"

This reverts commit 9a3987c.

* Re-run bundle install

* Upgrade to pagy 9

* Add test for callbacks controller

* Rubocop fix for new callbacks controller spec

Migrate to remove Devise user fields, Add bcrypt to gemfile

WIP

WIP - need to check tests

Fix accidental changes, clean-up

WIP

WIP - 106 failing tests

View and Controller tests working, WIP

WIP, in-progress for request tests

WIP - request tests fail when run in entire suite

Rubocop changes

WIP

WIP

Fix tests

Fix brakeman error for possible mass assignment

WIP

Correct add-username migration to allow for previous user data

WIP

WIP

WIP

* Test passing

* Rubocop fix

* WIP

* Add tests for sessions controller

* WIP

* Revert accidental migration changes

* WIP, broken nav tests

* WIP

* Update Ability model to match new layout

* WIP

* WIP

* LIBTREATDB-78 Remove application logic from navigation html

* WIP

* Correct Users navigation link

* Restore deleted helper files

* Add display name uniqueness, wip

* Adjust nav layout for middle-size screens

* Fix broken tests

* WIP

* Re-add shibboleth middleware

* Include ability testing for guest users, refactor ability tests

* Fix ability tests, align read-only permissions to actual permission

* Make test syntax more consistent

* Make all user default passwords 'notapassword'

* Add additional tests to sessions controller

* Add pinned rexml version, run bundle update, rubocop

* Rubocop fix

* Remove redundant loading of Simplecov that may be interfering with reporting

* Add tests, rename testing file

* Add admin users_controller delete test

* Ensure inactive users can edit account, logout. Remove password changing.

* Allow Admins to create new users with passwords

* Fix broken tests

* Test unsuccessful 'update' for admin/users

* Rubocop

---------

Co-authored-by: lisa3711 <[email protected]>
@Janell-Huyck Janell-Huyck force-pushed the 407-feature-branch-add-sso branch from 425070d to 92ad404 Compare October 17, 2024 13:30
Janell-Huyck and others added 9 commits October 17, 2024 15:44
* WIP

* Add /saml/metadata page and tests

* Add more waiting for External Repair modal in end-to-end spec

* Fix flaky end-to-end test

* Continue fixing flaky end-to-end test

* WIP - make requests local, add builder gem

* Set requests to not be local in production

* Update SAML per IT requests

* Remove middleware, refactor Shibboleth login for clarity

* WIP

* WIP - need testing

* WIP - careful with cookies

* WIP - Set errors to local true for production to see error message

* WIP - fix login route

* WIP - stop infinite loop

* WIP - log shib variables

* WIP set up rails logging route in production

* WIP

* Log shibboleth headers - WIP

* WIP - log all headers

* WIP - some broken tests

* WIP - update test files

* WIP - add logging headers and request.env

* WIP - stop redirects

* WIP - GPT rewrite

* WIP - add logging back in

* WIP - try to use /login path

* WIP - try to grab uid instead of username

* WIP - add Janell Huyck user to seeds

* WIP - use extracted username to log in

* WIP - correct preserve_shibboleth_cookies method

* WIP - fix logout, rubocop

* WIP - working on QA, has broken tests

* WIP - fixing tests

* Fix tests

* Rubocop

* Increase wait time on flaky portion of end-to-end

* Code cleanup

* Add Rondi, Glen, Lisa, Thomas to seeds file to access QA login after db reset.

* Attempt login without idp_certificate.pem

* Remove certificate added for previous attempt to use ruby-saml.

* Add tests for SessionsController

* Remove unused function in dev_sessions_controller
@Janell-Huyck Janell-Huyck changed the title WIP - FEATURE BRANCH - 407 Add SSO FEATURE BRANCH - 407 Add SSO Nov 21, 2024
#566)

* WIP: searching for the correct logout URL

* WIP: Split logout urls

* WIP: redirect to /Shibboleth.sso/Logout

* WIP: add return address after shibboleth logout

* WIP: move redirect URL to controller

* WIP: encode return URL for logout

* WIP: try to log out via JavaScript split methods

* WIP: Correct logout form action selector

* WIP: Log javascript, Use absolute Shibboleth logout URL

* WIP: Log out via invisible iframe

* WIP: use parameter on redirect to get flash message on logout

* WIP: Remove duplicate successful logout notification

* WIP: Test server-side only

* Code clean-up

* WIP: Debug loading of JS

* Make Sign Out button not be a form

* Reset qa deploy branch to 'qa'

* Debug nonfunctional logout by removing method: delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant