Add SAML 2.0 SSO.

Review Request #12254 — Created April 24, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

This change adds SAML 2.0 support for single-sign-on authentication. It
includes a few major pieces:

  • Infrastructure for SSO backends including registry, configuration
    machinery, and URL registration.
  • Updates to settings forms to allow me to toggle some subforms based on
    a checkbox enabler rather than via drop-downs.
  • SAML 2.0 backend which includes configuration, login/logout, and user
    provisioning.

The vast majority of the settings available are specific to SAML,
including the various URLs and method settings. Because of some user
feedback we've already recieved, I've added a toggle to control the
behavior of user provisioning. In most cases, the person using this has
absolute trust in the integrity and correctness of their IdP, but in
some cases that may not be true. If the "username" parameter can not
necessarily be trusted, there's an option to force existing users to log
in with their Review Board password at least once.

Testing was done with a test application on onelogin.com with the
relevant configuration to authenticate to my server on localhost.

  • Logged in with existing user that had a username match.
  • Logged in with user that had an email match and saw correct detection
    of the existing user.
  • Logged in with a user that had no existing match and saw provision
    screen. Proceeded and was logged in with a new user with correct
    name/email/etc.
  • Tested behavior of "require login" toggle.
  • Logged out from onelogin portal and saw GET request to the SLS
    endpoint which flushed the session and then redirected back to the
    onelogin login page.
  • Tested authentication configuration page, enabling/disabling settings,
    and making changes to settings. Tested behavior when the
    python3-saml package wasn't installed.
  • Tested text of button on login page, and that it redirected to the SSO
    login flow.
  • Ran unit tests.

Diff Revision 4

This is not the most recent revision of the diff. The latest diff is revision 15. See what's changed.

orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Commits

First Last Summary ID Author
[WIP] Add SAML 2.0 SSO.
This is the preliminary change for adding SAML 2.0 authentication. It includes a few major pieces: - Infrastructure for SSO backends including registry, configuration machinery, and URL registration. - Updates to settings forms to allow me to toggle some subforms based on a checkbox enabler rather than via drop-downs. - SAML 2.0 backend which includes configuration, login/logout, and user provisioning. The vast majority of the settings available are specific to SAML, including the various URLs and method settings. Because of some user feedback we've already recieved, I've added a toggle to control the behavior of user provisioning. In most cases, the person using this has absolute trust in the integrity and correctness of their IdP, but in some cases that may not be true. If the "username" parameter can not necessarily be trusted, there's an option to force existing users to log in with their Review Board password at least once. What's left to do: - "Login with SAML" button on the login screen. - Lots more unit testing. - Some refactoring of the link-user view to extract common functionality for other backends. - User/admin manual. Testing Done: Testing was done with a test application on onelogin.com with the relevant configuration to authenticate to my server on localhost. - Logged in with existing user that had a username match. - Logged in with user that had an email match and saw correct detection of the existing user. - Logged in with a user that had no existing match and saw provision screen. Proceeded and was logged in with a new user with correct name/email/etc. - Tested behavior of "require login" toggle. - Logged out from onelogin portal and saw GET request to the SLS endpoint which flushed the session and then redirected back to the onelogin login page. - Tested authentication configuration page, enabling/disabling settings, and making changes to settings. Tested behavior when the `python3-saml` package wasn't installed.
580aaefd8444bbe4036e8e449530b45987bcea2b David Trowbridge
setup.py
reviewboard/accounts/__init__.py
reviewboard/accounts/admin.py
reviewboard/accounts/models.py
reviewboard/accounts/urls.py
reviewboard/accounts/sso/__init__.py
reviewboard/accounts/sso/errors.py
reviewboard/accounts/sso/users.py
reviewboard/accounts/sso/views.py
reviewboard/accounts/sso/backends/__init__.py
reviewboard/accounts/sso/backends/base.py
reviewboard/accounts/sso/backends/registry.py
reviewboard/accounts/sso/backends/saml/__init__.py
reviewboard/accounts/sso/backends/saml/forms.py
reviewboard/accounts/sso/backends/saml/settings.py
reviewboard/accounts/sso/backends/saml/sso_backend.py
reviewboard/accounts/sso/backends/saml/views.py
reviewboard/accounts/tests/test_sso_backend_registry.py
reviewboard/admin/siteconfig.py
reviewboard/admin/urls.py
reviewboard/admin/forms/auth_settings.py
reviewboard/static/rb/css/common.less
reviewboard/static/rb/js/ui/views/formView.es6.js
reviewboard/templates/accounts/sso/link-user-connect-existing.html
reviewboard/templates/accounts/sso/link-user-login.html
reviewboard/templates/accounts/sso/link-user-provision.html
reviewboard/templates/admin/settings.html
reviewboard/templates/forms/subform.html
Loading...