Authentication using OpenID (#654)

* install app auth

* add service to handle auth

* add openid handling to general app

* move props to constructor

* update default api url to https

* add support for adjusting umbracoUrl from outside

* use origin url for redirect if empty from env

* merge origin/main

* merge origin/main

* add redirect uri support

* only check auth on firstUpdated

* merge origin/main

* fix redirect_uri

* listen for auth-success events before anything else

* save current route to restore after login

* set token function for all OpenAPI requests

* include credentials after login

* update openapi-typescript-codegen

* generate new models with bugfixes for CancelablePromise and request

* remove auth-success event

* wait with fetchServiceConfiguration until we actually need to query the server

* revert change where service configuration was delayed

* use LocalStorageBackend to save/restore token state

* improve documentation

* cleanup todos

* improve docs

* update documentation and set everything to private fields

* remove undefined

* add a token to provide server url

* add more docs

* provide the base url of the server through a token

* add more docs

* fix import

* allow to override the backoffice base url through a property

* use private modifier

* duplicate login image

* make generic error element to use as error page

* check for initialisation errors and show error page if necessary

* rename class to UmbAuthFlow

* control the notification manually with runtime status call

* add styling

* add stack to problemdetails

* forward all errors

* support problemdetails rendering

* allow passthrough without a token

* move error logic to function

* add support for BOOT_FAILED and default errors

* rename background img

* remove false character

* check for isMocking to simplify auth flow

* add support for generic ApiErrors

* make sure all errors from api controllers are ApiError or CancelError to be able to fine-tune the handling of them

* remove unused legacy method

* show notifications (for now) after session expiration

* break early on CancelErrors

* revert options argument

* remove login token after a 401 is detected

* catch api errors

* prefix class with Umb

* throw errors instead of using ProblemDetailsModel

* add TODO

* add TODO

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
This commit is contained in:
Jacob Overgaard
2023-04-24 12:27:25 +02:00
committed by GitHub
parent 69ab474812
commit 5ae631b223
49 changed files with 2550 additions and 17976 deletions

View File

@@ -43,8 +43,8 @@
"lint:fix": "npm run lint -- --fix",
"format": "prettier 'src/**/*.ts'",
"format:fix": "npm run format -- --write",
"generate:api": "openapi --input https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v13/dev/src/Umbraco.Cms.Api.Management/OpenApi.json --output libs/backend-api/src --postfix Resource --useOptions",
"generate:api-dev": "openapi --input http://localhost:11000/umbraco/swagger/v1/swagger.json --output libs/backend-api/src --postfix Resource --useOptions",
"generate:api": "openapi --input https://raw.githubusercontent.com/umbraco/Umbraco-CMS/v13/dev/src/Umbraco.Cms.Api.Management/OpenApi.json --output libs/backend-api/src --postfixServices Resource --useOptions",
"generate:api-dev": "openapi --input http://localhost:11000/umbraco/swagger/v1/swagger.json --output libs/backend-api/src --postfixServices Resource --useOptions",
"generate:jsonschema": "typescript-json-schema --required --include \"./libs/extensions-registry/*.ts\" --out dist/libs/umbraco-package-schema.json tsconfig.json UmbracoPackage",
"storybook": "npm run wc-analyze && storybook dev -p 6006",
"storybook:build": "npm run wc-analyze && storybook build",
@@ -61,6 +61,7 @@
"npm": ">=9.5 < 10"
},
"dependencies": {
"@openid/appauth": "^1.3.1",
"@umbraco-ui/uui": "^1.2.1",
"@umbraco-ui/uui-css": "^1.2.1",
"element-internals-polyfill": "^1.1.19",
@@ -108,7 +109,7 @@
"eslint-plugin-wc": "^1.4.0",
"msw": "^1.1.0",
"msw-storybook-addon": "^1.8.0",
"openapi-typescript-codegen": "^0.23.0",
"openapi-typescript-codegen": "^0.24.0",
"playwright-msw": "^2.1.0",
"plop": "^3.1.1",
"prettier": "2.8.4",