From c54ddc71a2ff06067bb65447853b62c9bc6d5b21 Mon Sep 17 00:00:00 2001 From: Silvan Date: Wed, 25 Jan 2023 14:08:01 +0100 Subject: [PATCH] feat(actions): local users (#5089) Actions are extended to to local users. It's possible to run custom code during registration and authentication of local users. --- .gitignore | 1 + CONTRIBUTING.md | 6 +- console/src/app/app.component.ts | 1 - .../auth-factor-dialog.component.html | 8 +- .../auth-user-mfa/auth-user-mfa.component.ts | 6 +- .../{login-flow.md => complement-token.md} | 12 +- ...ter-flow.md => external-authentication.md} | 19 +- .../apis/actions/internal-authentication.md | 90 +++++++ docs/docs/apis/actions/introduction.md | 7 +- docs/docs/apis/actions/objects.md | 45 ++++ docs/docs/guides/manage/customize/behavior.md | 2 +- docs/sidebars.js | 5 +- e2e/.gitignore | 1 + e2e/.prettierignore | 3 + e2e/.prettierrc.json | 2 +- e2e/cypress.config.ts | 1 - internal/actions/object/auth_request.go | 122 +++++++++ internal/actions/object/metadata.go | 85 ++++++ internal/actions/object/object.go | 14 + internal/actions/object/user.go | 19 +- internal/actions/object/user_grant.go | 68 +++++ internal/actions/provided.go | 7 - internal/api/grpc/action/action.go | 2 + internal/api/grpc/admin/export.go | 2 +- internal/api/grpc/management/flow.go | 1 + internal/api/ui/login/custom_action.go | 243 +++++++++--------- .../api/ui/login/external_login_handler.go | 4 +- .../api/ui/login/external_register_handler.go | 4 +- internal/api/ui/login/jwt_handler.go | 4 +- internal/api/ui/login/login.go | 1 - internal/api/ui/login/mfa_verify_handler.go | 8 + .../api/ui/login/mfa_verify_u2f_handler.go | 8 + internal/api/ui/login/password_handler.go | 8 + .../ui/login/passwordless_login_handler.go | 8 + internal/api/ui/login/register_handler.go | 39 ++- internal/command/instance_member.go | 3 +- internal/command/instance_member_test.go | 4 +- internal/command/org_member.go | 3 +- internal/command/org_member_test.go | 4 +- internal/command/project_member.go | 3 +- internal/command/project_member_test.go | 4 +- internal/domain/flow.go | 9 + internal/domain/request.go | 1 - internal/static/i18n/de.yaml | 1 + internal/static/i18n/en.yaml | 1 + internal/static/i18n/fr.yaml | 1 + internal/static/i18n/it.yaml | 1 + internal/static/i18n/zh.yaml | 1 + 48 files changed, 704 insertions(+), 188 deletions(-) rename docs/docs/apis/actions/{login-flow.md => complement-token.md} (87%) rename docs/docs/apis/actions/{register-flow.md => external-authentication.md} (89%) create mode 100644 docs/docs/apis/actions/internal-authentication.md create mode 100644 internal/actions/object/auth_request.go create mode 100644 internal/actions/object/object.go create mode 100644 internal/actions/object/user_grant.go delete mode 100644 internal/actions/provided.go diff --git a/.gitignore b/.gitignore index 6169749e73..333eb0f8f1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ profile.cov __debug_bin debug sandbox.go +/cmd/dev/ # IDE .idea diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3520156346..6713e31e00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -259,14 +259,14 @@ npm run lint:fix # Install npm dependencies npm install -# Run all tests in a headless browser -npm run e2e:dev +# Run all e2e tests +npm run e2e:dev -- --headed ``` You can also open the test suite interactively for fast success feedback on specific tests. ```bash -# Run all tests in a headless browser +# Run tests interactively npm run open:dev ``` diff --git a/console/src/app/app.component.ts b/console/src/app/app.component.ts index 39e331c6bc..16dbe053a8 100644 --- a/console/src/app/app.component.ts +++ b/console/src/app/app.component.ts @@ -202,7 +202,6 @@ export class AppComponent implements OnDestroy { .getActiveOrg() .then(async (org) => { this.org = org; - // TODO add when console storage is implemented // this.startIntroWorkflow(); }) diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-factor-dialog/auth-factor-dialog.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-factor-dialog/auth-factor-dialog.component.html index cc99cf48b4..0eedef35e0 100644 --- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-factor-dialog/auth-factor-dialog.component.html +++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-factor-dialog/auth-factor-dialog.component.html @@ -6,7 +6,13 @@

{{ 'USER.MFA.DIALOG.ADD_MFA_DESCRIPTION' | translate }}

-