From 98ebcacd941a5bc1aeb2eaab99e32ce1afb08948 Mon Sep 17 00:00:00 2001 From: Timshel Date: Thu, 28 Nov 2024 21:15:01 +0100 Subject: [PATCH] Move the sso_errors patch in button distribution --- CHANGELOG.md | 4 ++++ README.md | 14 +++++--------- build_webvault.sh | 2 +- oidc_override.patch | 2 +- oidc_sso_errors.patch | 35 +++++++++++++++++++++++++++++------ 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7b371f544..34318bbd2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2024.6.2d-rc2 + +- Apply the sso errors patch in the `button` distribution. + ## v2024.6.2d-rc1 - Upgrade to `BlackDex/bw_web_builds` to test dynamic CSS diff --git a/README.md b/README.md index f8bbed8a4e..6cd7f131d9 100644 --- a/README.md +++ b/README.md @@ -11,18 +11,17 @@ This is a repository to store custom builds of the [Bitwarden web vault](https:/ This generate three different versions : - `button` closest to what is expected to be merge into [bw_web_builds](https://github.com/dani-garcia/bw_web_builds)) - - restore the SSO login button ([patch](oidc_button.patch)) ( - allow organization invitation to survive sso account creation ([patch](oidc_invite.patch)) + - fix base url resolution ([patch](oidc_subpath.patch)) + - display SSO errors and redirect to start of the flow ([patch](oidc_sso_errors.patch)) - `override` add additionally : - set `#sso` as the default redirect url - remove some unnecessary logic ([patch](oidc_override.patch)) - - display SSO errors and redirect to start of the flow ([patch](oidc_sso_errors.patch)) -- `experimental` which stop sending the Master password hash to the server ([patch](oidc_experimental.patch)) ## Building the web-vault To build the web-vault you need node and npm installed. -### Using node 16 and npm +### Using node and npm For a quick and easy local build you can run: ```bash ./build_webvault.sh @@ -34,18 +33,15 @@ This will : - Clone a specific version of the [VaultWarden web vault builds](https://github.com/dani-garcia/bw_web_builds) - Copy ressources from the VaultWarden web vault project - Apply the VaultWarden web vault patch -- Apply the button [patch](oidc_button.patch) - Apply the invite [patch](oidc_invite.patch) +- Apply the url resolution [patch](oidc_subpath.patch) +- Apply the override [patch](oidc_sso_errors.patch) to improve SSO errors handling - Build the web vault application - Package it as `oidc_button_web_vault.tar.gz`. - Apply the override [patch](oidc_override.patch) to improve SSO flow -- Apply the override [patch](oidc_sso_errors.patch) to improve SSO errors handling - Apply the messages [patch](oidc_messages.patch) - Build the web vault application - Package it as `oidc_override_web_vault.tar.gz`. -- Apply the experimental [patch](oidc_experimental.patch) to improve SSO errors handling -- Build the web vault application -- Package it as `oidc_experimental_web_vault.tar.gz`. ### More information For more information see: [Install the web-vault](https://github.com/dani-garcia/vaultwarden/wiki/Building-binary#install-the-web-vault) diff --git a/build_webvault.sh b/build_webvault.sh index 37de6fc870..0601987a1a 100755 --- a/build_webvault.sh +++ b/build_webvault.sh @@ -37,6 +37,7 @@ fi # Apply org invite and subpath patch git apply ../oidc_invite.patch git apply ../oidc_subpath.patch +git apply ../oidc_sso_errors.patch if [ "$NO_BUILD" = false ] ; then cd apps/web @@ -50,7 +51,6 @@ fi # Apply the override and messages patches git apply ../oidc_override.patch -git apply ../oidc_sso_errors.patch git apply ../oidc_messages.patch git apply ../oidc_confirm_error.patch diff --git a/oidc_override.patch b/oidc_override.patch index 6746e85748..94a980ca09 100644 --- a/oidc_override.patch +++ b/oidc_override.patch @@ -67,7 +67,7 @@ index 4853b26e7..512b3a455 100644 +++ b/libs/angular/src/auth/guards/redirect.guard.ts @@ -15,7 +15,7 @@ export interface RedirectRoutes { - const defaultRoutes: RedirectRoutes = { + export const defaultRoutes: RedirectRoutes = { loggedIn: "/vault", - loggedOut: "/login", + loggedOut: "/sso", diff --git a/oidc_sso_errors.patch b/oidc_sso_errors.patch index c996db45d1..e7053be41f 100644 --- a/oidc_sso_errors.patch +++ b/oidc_sso_errors.patch @@ -1,14 +1,24 @@ Subject: [PATCH] Display all sso errors and reset flow --- - libs/angular/src/auth/components/sso.component.ts | 4 ++++ - 1 file changed, 4 insertions(+) + libs/angular/src/auth/components/sso.component.ts | 6 ++++++ + libs/angular/src/auth/guards/redirect.guard.ts | 2 +- + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/angular/src/auth/components/sso.component.ts b/libs/angular/src/auth/components/sso.component.ts -index 5fe65a065..526d973ca 100644 +index 30815beef8..ce562f8d22 100644 --- a/libs/angular/src/auth/components/sso.component.ts +++ b/libs/angular/src/auth/components/sso.component.ts -@@ -333,7 +333,11 @@ export class SsoComponent { +@@ -27,6 +27,8 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv + import { Utils } from "@bitwarden/common/platform/misc/utils"; + import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; + ++import { defaultRoutes } from "../guards/redirect.guard"; ++ + @Directive() + export class SsoComponent { + identifier: string; +@@ -363,7 +365,11 @@ export class SsoComponent { null, this.i18nService.t("ssoKeyConnectorError"), ); @@ -16,9 +26,22 @@ index 5fe65a065..526d973ca 100644 + this.platformUtilsService.showToast("error", null, e.message); } + this.router.routeReuseStrategy.shouldReuseRoute = () => false; -+ await this.router.navigate(["/sso"]); ++ await this.router.navigate([defaultRoutes.loggedOut]); } private async navigateViaCallbackOrRoute( +diff --git a/libs/angular/src/auth/guards/redirect.guard.ts b/libs/angular/src/auth/guards/redirect.guard.ts +index 760558dfb5..32adf64d52 100644 +--- a/libs/angular/src/auth/guards/redirect.guard.ts ++++ b/libs/angular/src/auth/guards/redirect.guard.ts +@@ -15,7 +15,7 @@ export interface RedirectRoutes { + notDecrypted: string; + } + +-const defaultRoutes: RedirectRoutes = { ++export const defaultRoutes: RedirectRoutes = { + loggedIn: "/vault", + loggedOut: "/login", + locked: "/lock", -- -2.39.2 +2.39.5