mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-15 19:31:03 -05:00
[PR #3899] [MERGED] SSO using OpenID Connect #6992
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/3899
Author: @Timshel
Created: 9/18/2023
Status: ✅ Merged
Merged: 8/8/2025
Merged by: @dani-garcia
Base:
main← Head:sso-support📝 Commits (10+)
671f7a1Add SSO functionality using OpenID Connectfefa55cImprovements and error handling524d65eStop rolling device token927968dAdd playwright testsd6af686Activate PKCE by defaultfb5b568Ensure result order when searching for sso_user8dfaee6add SSO_ALLOW_UNKNOWN_EMAIL_VERIFICATIONa9cc0e5Toggle SSO button in scssa85bdb2Base64 encode state before sending it to providers3617be0Prevent disabled User from SSO login📊 Changes
110 files changed (+8081 additions, -329 deletions)
View changed files
📝
.env.template(+53 -0)📝
Cargo.lock(+562 -10)📝
Cargo.toml(+8 -0)➕
SSO.md(+303 -0)➕
migrations/mysql/2023-09-10-133000_add_sso/down.sql(+1 -0)➕
migrations/mysql/2023-09-10-133000_add_sso/up.sql(+4 -0)➕
migrations/mysql/2023-09-14-133000_add_users_organizations_invited_by_email/down.sql(+1 -0)➕
migrations/mysql/2023-09-14-133000_add_users_organizations_invited_by_email/up.sql(+1 -0)➕
migrations/mysql/2024-02-14-170000_add_state_to_sso_nonce/down.sql(+6 -0)➕
migrations/mysql/2024-02-14-170000_add_state_to_sso_nonce/up.sql(+8 -0)➕
migrations/mysql/2024-02-26-170000_add_pkce_to_sso_nonce/down.sql(+8 -0)➕
migrations/mysql/2024-02-26-170000_add_pkce_to_sso_nonce/up.sql(+9 -0)➕
migrations/mysql/2024-03-06-170000_add_sso_users/down.sql(+1 -0)➕
migrations/mysql/2024-03-06-170000_add_sso_users/up.sql(+7 -0)➕
migrations/mysql/2024-03-13-170000_sso_users_cascade/down.sql(+0 -0)➕
migrations/mysql/2024-03-13-170000_sso_users_cascade/up.sql(+2 -0)➕
migrations/postgresql/2023-09-10-133000_add_sso/down.sql(+1 -0)➕
migrations/postgresql/2023-09-10-133000_add_sso/up.sql(+4 -0)➕
migrations/postgresql/2023-09-14-133000_add_users_organizations_invited_by_email/down.sql(+1 -0)➕
migrations/postgresql/2023-09-14-133000_add_users_organizations_invited_by_email/up.sql(+1 -0)...and 80 more files
📄 Description
This is based on previous PR (#2787, #2449 and #3154) with work done by @pinpox, @m4w0lf, @Sheap, @bmunro-peralex, @tribut and others I probably missed sorry.
This PR add support for OpenId Connect to handle authentication to an external SSO.
This introduce another way to control who can use the vault without having to use invitation or an LDAP.
A master password is still required and not controlled by the SSO (depending on your point of view this might be a feature ;).
Bitwarden key connector is not supported and due to the license it's highly unlikely that it will ever be:
Usage
This should be agnostic to the SSO used as long as it supports client secret authentication and expose an OpenID Connect Discovery endpoint. (I'm testing it with Keycloak at the moment, a demo test stack is available README.md)
Added some documentation at the root of the project SSO.md that could be later moved to the wiki.
I made some additional modification in my main branch to allow for easier testing (modified Docker image to use prebuilt patched front-end).
On front-end modification, I made patched versions available at Timshel/oidc_web_builds. Two versions are available :
button); all change needs to be compatible with the non-sso version.#ssoas the default redirect url.Issues
As mentioned in the previous PR one of the main issue is the inability for the organization invitation to work with the SSO redirection. To fix it a patch to the front-end is needed.
:warning:⚠️ ⚠️ If you have issues or need help testing the PR ⚠️ ⚠️ ⚠️
Please open issues in Timshel/vaultwarden in order to keep the discussion here focused on merging this work.
Of course if you believe your issue is important mention this PR so a reference will be visible.
But please try to keep commenting in this PR to a minimum to keep it legible, the previous one has over 200 comments ...
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.