Skip to content

Commit

Permalink
Move the sso_errors patch in button distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Timshel committed Nov 28, 2024
1 parent 16987d6 commit 98ebcac
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build_webvault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion oidc_override.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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: "/#",
+ loggedOut: "/sso",
Expand Down
35 changes: 29 additions & 6 deletions oidc_sso_errors.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
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"),
);
+ } else {
+ 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: "/#",
locked: "/lock",
--
2.39.2
2.39.5

0 comments on commit 98ebcac

Please # to comment.