@equinor/fusion-framework-module-msal
Advanced tools
Comparing version 3.2.0-msal-a48dcfe523e40243313637b31b0dc70d1b1ddc47 to 4.0.0-next-663bed8344cc2ca0111705b05045173328b3104d
215
CHANGELOG.md
# Change Log | ||
## 3.2.0-msal-a48dcfe523e40243313637b31b0dc70d1b1ddc47 | ||
## 4.0.0-next-663bed8344cc2ca0111705b05045173328b3104d | ||
### Minor Changes | ||
### Major Changes | ||
- [#1944](https://github.com/equinor/fusion-framework/pull/1944) [`abe4041`](https://github.com/equinor/fusion-framework/commit/abe404176c6dd987f785ddb2d3df2d26d3a230ea) Thanks [@odinr](https://github.com/odinr)! - Added functionality for setting default authentication behavior (`redirect` or `popup`) when creating authentication client. | ||
- [#2510](https://github.com/equinor/fusion-framework/pull/2510) [`663bed8`](https://github.com/equinor/fusion-framework/commit/663bed8344cc2ca0111705b05045173328b3104d) Thanks [@eikeland](https://github.com/eikeland)! - BREAKING_CHANGE: all fusion-framework modules are now defiend as type module. | ||
```ts | ||
const client = new AuthClient( | ||
"TENNANT_ID", | ||
> [!WARNING] | ||
> This will introduce breaking changes to the consumption of fusion-framework moduels. | ||
### Patch Changes | ||
- Updated dependencies [[`663bed8`](https://github.com/equinor/fusion-framework/commit/663bed8344cc2ca0111705b05045173328b3104d)]: | ||
- @equinor/fusion-framework-module@5.0.0-next-663bed8344cc2ca0111705b05045173328b3104d | ||
## 3.1.5 | ||
### Patch Changes | ||
- Updated dependencies [[`2644b3d`](https://github.com/equinor/fusion-framework/commit/2644b3d63939aede736a3b1950db32dbd487877d)]: | ||
- @equinor/fusion-framework-module@4.3.5 | ||
## 3.1.4 | ||
### Patch Changes | ||
- Updated dependencies [[`75d676d`](https://github.com/equinor/fusion-framework/commit/75d676d2c7919f30e036b5ae97c4d814c569aa87), [`00d5e9c`](https://github.com/equinor/fusion-framework/commit/00d5e9c632876742c3d2a74efea2f126a0a169d9)]: | ||
- @equinor/fusion-framework-module@4.3.4 | ||
## 3.1.3 | ||
### Patch Changes | ||
- Updated dependencies [[`a1524e9`](https://github.com/equinor/fusion-framework/commit/a1524e9c4d83778da3db42dbcf99908b776a0592)]: | ||
- @equinor/fusion-framework-module@4.3.3 | ||
## 3.1.2 | ||
### Patch Changes | ||
- [#2333](https://github.com/equinor/fusion-framework/pull/2333) [`86d55b8`](https://github.com/equinor/fusion-framework/commit/86d55b8d27a572f3f62170b1e72aceda54f955e1) Thanks [@odinr](https://github.com/odinr)! - Updated `TypeScript` to 5.5.3 | ||
- [#2320](https://github.com/equinor/fusion-framework/pull/2320) [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee) Thanks [@odinr](https://github.com/odinr)! - Removed the `removeComments` option from the `tsconfig.base.json` file. | ||
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons: | ||
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions. | ||
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output. | ||
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking. | ||
No action is required from consumers of the library. This change affects the build process and doesn't introduce any breaking changes or new features. | ||
Before: | ||
```json | ||
{ | ||
/** auth client options */ | ||
}, | ||
"redirect" || "popup", | ||
); | ||
``` | ||
"compilerOptions": { | ||
"module": "ES2022", | ||
"target": "ES6", | ||
"incremental": true, | ||
"removeComments": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
"moduleResolution": "node" | ||
} | ||
} | ||
``` | ||
- [#1944](https://github.com/equinor/fusion-framework/pull/1944) [`7abe10c`](https://github.com/equinor/fusion-framework/commit/7abe10c352201fa2d9d2f8f65adb6cca2e79134a) Thanks [@odinr](https://github.com/odinr)! - Changed `handleRedirect` to check the state of `handleRedirectPromise`, since login threw popup should not trigger redirect. | ||
After: | ||
Added flag in login state | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"module": "ES2022", | ||
"target": "ES6", | ||
"incremental": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
"moduleResolution": "node" | ||
} | ||
} | ||
``` | ||
- `internal` [_default_] when login was triggered from same frame | ||
- `external` login was triggered by a iframe | ||
This change ensures that comments are preserved in the compiled output, potentially improving the development and debugging experience for users of the Fusion Framework. | ||
- Updated dependencies [[`2f74edc`](https://github.com/equinor/fusion-framework/commit/2f74edcd4a3ea2b87d69f0fd63492145c3c01663), [`86d55b8`](https://github.com/equinor/fusion-framework/commit/86d55b8d27a572f3f62170b1e72aceda54f955e1), [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee)]: | ||
- @equinor/fusion-framework-module@4.3.2 | ||
## 3.1.1 | ||
### Patch Changes | ||
- Updated dependencies [[`fb424be`](https://github.com/equinor/fusion-framework/commit/fb424be24ad9349d01daef91a01c464d7b1413d2), [`fb424be`](https://github.com/equinor/fusion-framework/commit/fb424be24ad9349d01daef91a01c464d7b1413d2), [`fb424be`](https://github.com/equinor/fusion-framework/commit/fb424be24ad9349d01daef91a01c464d7b1413d2)]: | ||
- @equinor/fusion-framework-module@4.3.1 | ||
## 3.1.0 | ||
@@ -30,8 +101,8 @@ | ||
- [#1953](https://github.com/equinor/fusion-framework/pull/1953) [`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904) Thanks [@odinr](https://github.com/odinr)! - updated typescript to 5.4.2 | ||
- [#1953](https://github.com/equinor/fusion-framework/pull/1953) [`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904) Thanks [@odinr](https://github.com/odinr)! - updated typescript to 5.4.2 | ||
### Patch Changes | ||
- Updated dependencies [[`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904), [`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904)]: | ||
- @equinor/fusion-framework-module@4.3.0 | ||
- Updated dependencies [[`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904), [`f3ae28d`](https://github.com/equinor/fusion-framework/commit/f3ae28dc6d1d5043605e07e2cd2e83ae799cd904)]: | ||
- @equinor/fusion-framework-module@4.3.0 | ||
@@ -42,4 +113,4 @@ ## 3.0.10 | ||
- Updated dependencies [[`152cf73`](https://github.com/equinor/fusion-framework/commit/152cf73d39eb32ccbaddaa6941e315c437c4972d)]: | ||
- @equinor/fusion-framework-module@4.2.7 | ||
- Updated dependencies [[`152cf73`](https://github.com/equinor/fusion-framework/commit/152cf73d39eb32ccbaddaa6941e315c437c4972d)]: | ||
- @equinor/fusion-framework-module@4.2.7 | ||
@@ -50,3 +121,3 @@ ## 3.0.9 | ||
- [#1646](https://github.com/equinor/fusion-framework/pull/1646) [`5eab8af`](https://github.com/equinor/fusion-framework/commit/5eab8afe3c3106cc67ad14ce4cbee6c7e4e8dfb1) Thanks [@odinr](https://github.com/odinr)! - re-export `AuthenticationResult` from `@azure/msal-browser` | ||
- [#1646](https://github.com/equinor/fusion-framework/pull/1646) [`5eab8af`](https://github.com/equinor/fusion-framework/commit/5eab8afe3c3106cc67ad14ce4cbee6c7e4e8dfb1) Thanks [@odinr](https://github.com/odinr)! - re-export `AuthenticationResult` from `@azure/msal-browser` | ||
@@ -57,6 +128,6 @@ ## 3.0.8 | ||
- [#1595](https://github.com/equinor/fusion-framework/pull/1595) [`9c24e84`](https://github.com/equinor/fusion-framework/commit/9c24e847d041dea8384c77439e6b237f5bdb3125) Thanks [@Gustav-Eikaas](https://github.com/Gustav-Eikaas)! - support for module resolution NodeNext & Bundler | ||
- [#1595](https://github.com/equinor/fusion-framework/pull/1595) [`9c24e84`](https://github.com/equinor/fusion-framework/commit/9c24e847d041dea8384c77439e6b237f5bdb3125) Thanks [@Gustav-Eikaas](https://github.com/Gustav-Eikaas)! - support for module resolution NodeNext & Bundler | ||
- Updated dependencies [[`9c24e84`](https://github.com/equinor/fusion-framework/commit/9c24e847d041dea8384c77439e6b237f5bdb3125)]: | ||
- @equinor/fusion-framework-module@4.2.6 | ||
- Updated dependencies [[`9c24e84`](https://github.com/equinor/fusion-framework/commit/9c24e847d041dea8384c77439e6b237f5bdb3125)]: | ||
- @equinor/fusion-framework-module@4.2.6 | ||
@@ -67,6 +138,6 @@ ## 3.0.7 | ||
- [`b5dfe5d2`](https://github.com/equinor/fusion-framework/commit/b5dfe5d29a249e0cca6c9589322931dfedd06acc) Thanks [@odinr](https://github.com/odinr)! - force patch bump, realign missing snapshot | ||
- [`b5dfe5d2`](https://github.com/equinor/fusion-framework/commit/b5dfe5d29a249e0cca6c9589322931dfedd06acc) Thanks [@odinr](https://github.com/odinr)! - force patch bump, realign missing snapshot | ||
- Updated dependencies [[`b5dfe5d2`](https://github.com/equinor/fusion-framework/commit/b5dfe5d29a249e0cca6c9589322931dfedd06acc)]: | ||
- @equinor/fusion-framework-module@4.2.5 | ||
- Updated dependencies [[`b5dfe5d2`](https://github.com/equinor/fusion-framework/commit/b5dfe5d29a249e0cca6c9589322931dfedd06acc)]: | ||
- @equinor/fusion-framework-module@4.2.5 | ||
@@ -77,4 +148,4 @@ ## 3.0.6 | ||
- Updated dependencies [[`9076a498`](https://github.com/equinor/fusion-framework/commit/9076a49876e7a414a27557b7fb9095a67fe3a57f)]: | ||
- @equinor/fusion-framework-module@4.2.4 | ||
- Updated dependencies [[`9076a498`](https://github.com/equinor/fusion-framework/commit/9076a49876e7a414a27557b7fb9095a67fe3a57f)]: | ||
- @equinor/fusion-framework-module@4.2.4 | ||
@@ -85,10 +156,10 @@ ## 3.0.5 | ||
- [#1109](https://github.com/equinor/fusion-framework/pull/1109) [`7ec195d4`](https://github.com/equinor/fusion-framework/commit/7ec195d42098fec8794db13e83b71ef7753ff862) Thanks [@odinr](https://github.com/odinr)! - Change packaged manager from yarn to pnpm | ||
- [#1109](https://github.com/equinor/fusion-framework/pull/1109) [`7ec195d4`](https://github.com/equinor/fusion-framework/commit/7ec195d42098fec8794db13e83b71ef7753ff862) Thanks [@odinr](https://github.com/odinr)! - Change packaged manager from yarn to pnpm | ||
conflicts of `@types/react` made random outcomes when using `yarn` | ||
conflicts of `@types/react` made random outcomes when using `yarn` | ||
this change should not affect consumer of the packages, but might conflict dependent on local package manager. | ||
this change should not affect consumer of the packages, but might conflict dependent on local package manager. | ||
- Updated dependencies [[`7ec195d4`](https://github.com/equinor/fusion-framework/commit/7ec195d42098fec8794db13e83b71ef7753ff862), [`d276fc5d`](https://github.com/equinor/fusion-framework/commit/d276fc5d514566d05c64705076a1cb91c6a44272)]: | ||
- @equinor/fusion-framework-module@4.2.3 | ||
- Updated dependencies [[`7ec195d4`](https://github.com/equinor/fusion-framework/commit/7ec195d42098fec8794db13e83b71ef7753ff862), [`d276fc5d`](https://github.com/equinor/fusion-framework/commit/d276fc5d514566d05c64705076a1cb91c6a44272)]: | ||
- @equinor/fusion-framework-module@4.2.3 | ||
@@ -99,6 +170,6 @@ ## 3.0.4 | ||
- [#946](https://github.com/equinor/fusion-framework/pull/946) [`5a160d88`](https://github.com/equinor/fusion-framework/commit/5a160d88981ddfe861d391cfefe10f54dda3d352) Thanks [@odinr](https://github.com/odinr)! - Build/update typescript to 5 | ||
- [#946](https://github.com/equinor/fusion-framework/pull/946) [`5a160d88`](https://github.com/equinor/fusion-framework/commit/5a160d88981ddfe861d391cfefe10f54dda3d352) Thanks [@odinr](https://github.com/odinr)! - Build/update typescript to 5 | ||
- Updated dependencies [[`5a160d88`](https://github.com/equinor/fusion-framework/commit/5a160d88981ddfe861d391cfefe10f54dda3d352)]: | ||
- @equinor/fusion-framework-module@4.2.1 | ||
- Updated dependencies [[`5a160d88`](https://github.com/equinor/fusion-framework/commit/5a160d88981ddfe861d391cfefe10f54dda3d352)]: | ||
- @equinor/fusion-framework-module@4.2.1 | ||
@@ -109,10 +180,10 @@ ## 3.0.3 | ||
- [#905](https://github.com/equinor/fusion-framework/pull/905) [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c) Thanks [@odinr](https://github.com/odinr)! - **🚧 Chore: dedupe packages** | ||
- [#905](https://github.com/equinor/fusion-framework/pull/905) [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c) Thanks [@odinr](https://github.com/odinr)! - **🚧 Chore: dedupe packages** | ||
- align all versions of typescript | ||
- update types to build | ||
- a couple of typecasts did not [satisfies](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#satisfies-support-in-jsdoc) and was recasted as `unknwon`, marked with `TODO`, should be fixed in future | ||
- align all versions of typescript | ||
- update types to build | ||
- a couple of typecasts did not [satisfies](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#satisfies-support-in-jsdoc) and was recasted as `unknwon`, marked with `TODO`, should be fixed in future | ||
- Updated dependencies [[`3efbf0bb`](https://github.com/equinor/fusion-framework/commit/3efbf0bb93fc11aa158872cd6ab98a22bcfb59e5), [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9), [`76b30c1e`](https://github.com/equinor/fusion-framework/commit/76b30c1e86db3db18adbe759bb1e39885de1c898), [`83ee5abf`](https://github.com/equinor/fusion-framework/commit/83ee5abf7bcab193c85980e5ae44895cd7f6f08d), [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9), [`060818eb`](https://github.com/equinor/fusion-framework/commit/060818eb04ebb9ed6deaed1f0b4530201b1181cf), [`3efbf0bb`](https://github.com/equinor/fusion-framework/commit/3efbf0bb93fc11aa158872cd6ab98a22bcfb59e5), [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c)]: | ||
- @equinor/fusion-framework-module@4.2.0 | ||
- Updated dependencies [[`3efbf0bb`](https://github.com/equinor/fusion-framework/commit/3efbf0bb93fc11aa158872cd6ab98a22bcfb59e5), [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9), [`76b30c1e`](https://github.com/equinor/fusion-framework/commit/76b30c1e86db3db18adbe759bb1e39885de1c898), [`83ee5abf`](https://github.com/equinor/fusion-framework/commit/83ee5abf7bcab193c85980e5ae44895cd7f6f08d), [`7500ec2c`](https://github.com/equinor/fusion-framework/commit/7500ec2c9ca9b926a19539fc97c61c67f76fc8d9), [`060818eb`](https://github.com/equinor/fusion-framework/commit/060818eb04ebb9ed6deaed1f0b4530201b1181cf), [`3efbf0bb`](https://github.com/equinor/fusion-framework/commit/3efbf0bb93fc11aa158872cd6ab98a22bcfb59e5), [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c)]: | ||
- @equinor/fusion-framework-module@4.2.0 | ||
@@ -166,3 +237,3 @@ All notable changes to this project will be documented in this file. | ||
- **module-msal:** await redirect handling ([92686d2](https://github.com/equinor/fusion-framework/commit/92686d2ae054d7f507093b839edb2fe5775c7449)) | ||
- **module-msal:** await redirect handling ([92686d2](https://github.com/equinor/fusion-framework/commit/92686d2ae054d7f507093b839edb2fe5775c7449)) | ||
@@ -173,3 +244,3 @@ ## 1.0.18 (2022-11-11) | ||
- **module-auth:** make http module await auth ([18a0ed9](https://github.com/equinor/fusion-framework/commit/18a0ed947e128bf1cdc86aa45d31e73c1f8c4bbb)) | ||
- **module-auth:** make http module await auth ([18a0ed9](https://github.com/equinor/fusion-framework/commit/18a0ed947e128bf1cdc86aa45d31e73c1f8c4bbb)) | ||
@@ -216,3 +287,3 @@ ## 1.0.17 (2022-11-03) | ||
- update registering of configuration ([20942ce](https://github.com/equinor/fusion-framework/commit/20942ce1c7a853ea3b55c031a242646e378db8c9)) | ||
- update registering of configuration ([20942ce](https://github.com/equinor/fusion-framework/commit/20942ce1c7a853ea3b55c031a242646e378db8c9)) | ||
@@ -259,7 +330,7 @@ ## 1.0.7 (2022-09-20) | ||
- **module-msal:** expose simple config ([596c4c2](https://github.com/equinor/fusion-framework/commit/596c4c222a75bfef67e2e129792f6132cbceb47c)) | ||
- **module-msal:** expose simple config ([596c4c2](https://github.com/equinor/fusion-framework/commit/596c4c222a75bfef67e2e129792f6132cbceb47c)) | ||
### Bug Fixes | ||
- **module-msal:** set default logging to errors ([1b53be8](https://github.com/equinor/fusion-framework/commit/1b53be816600c838257f0b3c6f3a338466938a3f)) | ||
- **module-msal:** set default logging to errors ([1b53be8](https://github.com/equinor/fusion-framework/commit/1b53be816600c838257f0b3c6f3a338466938a3f)) | ||
@@ -270,7 +341,7 @@ ## [1.0.0-alpha.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.4.2...@equinor/fusion-framework-module-msal@1.0.0-alpha.0) (2022-09-12) | ||
- **module-msal:** expose simple config ([596c4c2](https://github.com/equinor/fusion-framework/commit/596c4c222a75bfef67e2e129792f6132cbceb47c)) | ||
- **module-msal:** expose simple config ([596c4c2](https://github.com/equinor/fusion-framework/commit/596c4c222a75bfef67e2e129792f6132cbceb47c)) | ||
### Bug Fixes | ||
- **module-msal:** set default logging to errors ([1b53be8](https://github.com/equinor/fusion-framework/commit/1b53be816600c838257f0b3c6f3a338466938a3f)) | ||
- **module-msal:** set default logging to errors ([1b53be8](https://github.com/equinor/fusion-framework/commit/1b53be816600c838257f0b3c6f3a338466938a3f)) | ||
@@ -289,19 +360,19 @@ ## 0.4.2 (2022-09-05) | ||
- rename fetch | ||
- rename fetch | ||
- fix(module-service-discovery): update http client consumer | ||
- fix(module-service-discovery): update http client consumer | ||
- build: update allowed branches | ||
- build: update allowed branches | ||
- build: add conventional commit | ||
- build: add conventional commit | ||
- build: use conventionalcommits | ||
- build: use conventionalcommits | ||
- build(module-http): push major | ||
- build(module-http): push major | ||
- build: update deps | ||
- build: update deps | ||
### Features | ||
- rename fetch method ([#226](https://github.com/equinor/fusion-framework/issues/226)) ([f02df7c](https://github.com/equinor/fusion-framework/commit/f02df7cdd2b9098b0da49c5ea56ac3b6a17e9e32)) | ||
- rename fetch method ([#226](https://github.com/equinor/fusion-framework/issues/226)) ([f02df7c](https://github.com/equinor/fusion-framework/commit/f02df7cdd2b9098b0da49c5ea56ac3b6a17e9e32)) | ||
@@ -318,7 +389,7 @@ ## 0.3.2 (2022-08-19) | ||
- feat!: allow modules to displose ([32b69fb](https://github.com/equinor/fusion-framework/commit/32b69fb7cc61e78e503e67d0e77f21fb44b600b9)) | ||
- feat!: allow modules to displose ([32b69fb](https://github.com/equinor/fusion-framework/commit/32b69fb7cc61e78e503e67d0e77f21fb44b600b9)) | ||
### BREAKING CHANGES | ||
- module.initialize now has object as arg | ||
- module.initialize now has object as arg | ||
@@ -329,3 +400,3 @@ # 0.2.0 (2022-08-08) | ||
- **module-service-discovery:** resolve service to config ([3fa088d](https://github.com/equinor/fusion-framework/commit/3fa088d2ced8136447df6949928f1af9fc83407a)) | ||
- **module-service-discovery:** resolve service to config ([3fa088d](https://github.com/equinor/fusion-framework/commit/3fa088d2ced8136447df6949928f1af9fc83407a)) | ||
@@ -344,3 +415,3 @@ ## [0.1.24](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.23...@equinor/fusion-framework-module-msal@0.1.24) (2022-08-04) | ||
- change typo of exports ([b049503](https://github.com/equinor/fusion-framework/commit/b049503511fb1b37b920b00aed1468ed8385a67e)) | ||
- change typo of exports ([b049503](https://github.com/equinor/fusion-framework/commit/b049503511fb1b37b920b00aed1468ed8385a67e)) | ||
@@ -399,3 +470,3 @@ ## [0.1.21](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.20...@equinor/fusion-framework-module-msal@0.1.21) (2022-07-01) | ||
- **module-msal:** prevent redirect loop ([2d0f57c](https://github.com/equinor/fusion-framework/commit/2d0f57c737282f485099ff2562b4c4c956f8e30a)) | ||
- **module-msal:** prevent redirect loop ([2d0f57c](https://github.com/equinor/fusion-framework/commit/2d0f57c737282f485099ff2562b4c4c956f8e30a)) | ||
@@ -406,3 +477,3 @@ ## 0.1.8 (2022-03-25) | ||
- **modules-msal:** change regex group selector ([ebaa118](https://github.com/equinor/fusion-framework/commit/ebaa11849303e68f67544f8db57727673f821744)) | ||
- **modules-msal:** change regex group selector ([ebaa118](https://github.com/equinor/fusion-framework/commit/ebaa11849303e68f67544f8db57727673f821744)) | ||
@@ -413,3 +484,3 @@ ## [0.1.7](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.6...@equinor/fusion-framework-module-msal@0.1.7) (2022-02-23) | ||
- **module-msal:** await auth ([#33](https://github.com/equinor/fusion-framework/issues/33)) ([d4c3dbd](https://github.com/equinor/fusion-framework/commit/d4c3dbd0afc6a3adebe23853ccd363d1bf37f131)) | ||
- **module-msal:** await auth ([#33](https://github.com/equinor/fusion-framework/issues/33)) ([d4c3dbd](https://github.com/equinor/fusion-framework/commit/d4c3dbd0afc6a3adebe23853ccd363d1bf37f131)) | ||
@@ -420,3 +491,3 @@ ## [0.1.6](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.5...@equinor/fusion-framework-module-msal@0.1.6) (2022-02-23) | ||
- deps ([2f2938b](https://github.com/equinor/fusion-framework/commit/2f2938b554610a068ed451623dd13480cae27302)) | ||
- deps ([2f2938b](https://github.com/equinor/fusion-framework/commit/2f2938b554610a068ed451623dd13480cae27302)) | ||
@@ -427,3 +498,3 @@ ## [0.1.5](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.4...@equinor/fusion-framework-module-msal@0.1.5) (2022-02-23) | ||
- add missing deps ([d689a02](https://github.com/equinor/fusion-framework/commit/d689a025613401eadf693bdd52694ba462dcfea3)) | ||
- add missing deps ([d689a02](https://github.com/equinor/fusion-framework/commit/d689a025613401eadf693bdd52694ba462dcfea3)) | ||
@@ -442,3 +513,3 @@ ## [0.1.4](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-msal@0.1.3...@equinor/fusion-framework-module-msal@0.1.4) (2022-02-23) | ||
- **module-msal:** auth client id check ([#27](https://github.com/equinor/fusion-framework/issues/27)) ([907460e](https://github.com/equinor/fusion-framework/commit/907460e3e63e777f6766dcc044cad7078d7ab747)) | ||
- **module-msal:** auth client id check ([#27](https://github.com/equinor/fusion-framework/issues/27)) ([907460e](https://github.com/equinor/fusion-framework/commit/907460e3e63e777f6766dcc044cad7078d7ab747)) | ||
@@ -453,8 +524,8 @@ ## 0.1.1 (2022-02-09) | ||
- **module-msal:** invert bool check of scopes ([3d9fb50](https://github.com/equinor/fusion-framework/commit/3d9fb50e4b3d408cab4f6e68c44ca9045e8ce40d)) | ||
- **module-msal:** invert bool check of scopes ([3d9fb50](https://github.com/equinor/fusion-framework/commit/3d9fb50e4b3d408cab4f6e68c44ca9045e8ce40d)) | ||
### Features | ||
- add client for msal ([41e6b13](https://github.com/equinor/fusion-framework/commit/41e6b1378f41b1e03023186d480460a0189878c6)) | ||
- **module-msal:** change behavoir to redirect ([9f2193f](https://github.com/equinor/fusion-framework/commit/9f2193f21a7056cb6b42513845fdc19910522628)) | ||
- **module-msal:** expose account ([f4b27b3](https://github.com/equinor/fusion-framework/commit/f4b27b3db7cf5133afbaf366ba953561dd23c113)) | ||
- add client for msal ([41e6b13](https://github.com/equinor/fusion-framework/commit/41e6b1378f41b1e03023186d480460a0189878c6)) | ||
- **module-msal:** change behavoir to redirect ([9f2193f](https://github.com/equinor/fusion-framework/commit/9f2193f21a7056cb6b42513845fdc19910522628)) | ||
- **module-msal:** expose account ([f4b27b3](https://github.com/equinor/fusion-framework/commit/f4b27b3db7cf5133afbaf366ba953561dd23c113)) |
@@ -0,2 +1,5 @@ | ||
/** | ||
* Default behavior for login and acquisition of token | ||
*/ | ||
export const defaultBehavior = 'redirect'; | ||
//# sourceMappingURL=behavior.js.map |
@@ -10,17 +10,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _AuthClient_behavior; | ||
import { PublicClientApplication, } from '@azure/msal-browser'; | ||
import { defaultBehavior } from './behavior'; | ||
/** | ||
* ### Simple extension of Microsoft`s authentication client. | ||
* | ||
* When using this client tenant is **required** since common login is deprecated after all. | ||
* By providing tenant the user account can simple be extracted from current session *if any*. | ||
* | ||
* @example | ||
* ```typescript | ||
* const tenantId = '224123a0d-7990-4ba1-aff3-1dss9569af32'; | ||
* const authPath = '/my-app/auth'; | ||
* const client = new AuthClient(tenantId, { | ||
* auth: { | ||
* clientId: '6dab35d4-59ff-4dcc-3356-24479e6fc888', | ||
* authority: `https://login.microsoftonline.com/${tenantId}`, | ||
* redirectUri: window.location.origin + '/my-app/auth' | ||
* } | ||
* }); | ||
* document.getElementById('login-btn').addEventListener('click', () => | ||
* client.login({ scopes: ['data.read'] }) | ||
* .then(console.log) | ||
* .catch(console.error) | ||
* ); | ||
* (async() => { | ||
* if(window.location.path === authPath) { | ||
* await client.handleRedirectPromise() | ||
* } | ||
* )(); | ||
* ``` | ||
* @see [Microsoft Authentication Library](https://github.com/AzureAD/microsoft-authentication-library-for-js) | ||
* @see [Microsoft identity platform](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow) | ||
*/ | ||
export class AuthClient extends PublicClientApplication { | ||
/** | ||
* @returns | ||
* Returns account for client tenant that MSAL currently has data for. | ||
* (the account object is created at the time of successful login) | ||
*/ | ||
get account() { | ||
@@ -40,2 +64,5 @@ const accounts = this.getAllAccounts(); | ||
} | ||
/** | ||
* @returns - Configured client id | ||
*/ | ||
get clientId() { | ||
@@ -48,10 +75,23 @@ var _a; | ||
} | ||
constructor(tenantId, config, behavior = defaultBehavior) { | ||
/** | ||
* @param tenantId - tenant id for client domain | ||
* @param config - required [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/src/config/Configuration.ts) | ||
*/ | ||
constructor(tenantId, config) { | ||
super(config); | ||
this.tenantId = tenantId; | ||
_AuthClient_behavior.set(this, void 0); | ||
__classPrivateFieldSet(this, _AuthClient_behavior, behavior, "f"); | ||
} | ||
/** | ||
* @param silent | ||
* Attempt to use a hidden iframe to fetch an authorization code from the eSTS if {@link AuthClient.account} or login hint. | ||
* Provided {@link AuthBehavior} is used as fallback. | ||
* There are cases where this may not work: | ||
* - Any browser using a form of Intelligent Tracking Prevention | ||
* - If there is not an established session with the service | ||
* | ||
* @returns | ||
* Promise that is fulfilled when this function has completed, or rejected if an error was raised. | ||
*/ | ||
login(options_1) { | ||
return __awaiter(this, arguments, void 0, function* (options, behavior = __classPrivateFieldGet(this, _AuthClient_behavior, "f"), silent = true) { | ||
return __awaiter(this, arguments, void 0, function* (options, behavior = defaultBehavior, silent = true) { | ||
var _a; | ||
@@ -81,4 +121,18 @@ const loginHint = (options === null || options === void 0 ? void 0 : options.loginHint) || ((_a = this.account) === null || _a === void 0 ? void 0 : _a.username); | ||
} | ||
/** | ||
* Will try to silently acquire an access token for a given set of scopes. | ||
* Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token. | ||
* | ||
* @param silent | ||
* Attempt to use a hidden iframe to fetch an authorization code from the eSTS if {@link AuthClient.account} or login hint. | ||
* Provided {@link AuthBehavior} is used as fallback. | ||
* There are cases where this may not work: | ||
* - Any browser using a form of Intelligent Tracking Prevention | ||
* - If there is not an established session with the service | ||
* | ||
* @returns | ||
* Promise that is fulfilled when this function has completed, or rejected if an error was raised. | ||
*/ | ||
acquireToken() { | ||
return __awaiter(this, arguments, void 0, function* (options = { scopes: [] }, behavior = __classPrivateFieldGet(this, _AuthClient_behavior, "f"), silent = true) { | ||
return __awaiter(this, arguments, void 0, function* (options = { scopes: [] }, behavior = defaultBehavior, silent = true) { | ||
const account = yield this.account; | ||
@@ -106,4 +160,3 @@ if (silent && account) { | ||
} | ||
_AuthClient_behavior = new WeakMap(); | ||
export default AuthClient; | ||
//# sourceMappingURL=client.js.map |
import { AuthClient } from './client'; | ||
import { normalizeUri } from './util/url'; | ||
/** | ||
* Creates an authentication client with basic config. | ||
* | ||
* @example | ||
* ```typescript | ||
* const myClient = createClient( | ||
* '224123a0d-7990-4ba1-aff3-1dss9569af32', | ||
* '6dab35d4-59ff-4dcc-3356-24479e6fc888', | ||
* '/my-app/auth' | ||
* ); | ||
* ``` | ||
* | ||
* @template T - client type, default to {@link AuthClient} | ||
* | ||
* @param tenantId - tenant to for authentication | ||
* @param clientId - client id for authentication | ||
* @param redirectUri - callback url for authentication (must match exact configured url in app) | ||
* @param config - optional [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/src/config/Configuration.ts) | ||
* @param ctor - optional client class | ||
*/ | ||
export const createAuthClient = (tenantId, clientId, redirectUri, config, ctor) => { | ||
const auth = Object.assign({ clientId, redirectUri: normalizeUri(redirectUri || ''), navigateToLoginRequestUrl: false, authority: `https://login.microsoftonline.com/${tenantId}` }, config === null || config === void 0 ? void 0 : config.auth); | ||
const cache = Object.assign({ cacheLocation: 'localStorage' }, config === null || config === void 0 ? void 0 : config.cache); | ||
const { behavior, system } = config !== null && config !== void 0 ? config : {}; | ||
return new (ctor || AuthClient)(tenantId, { auth, cache, system }, behavior); | ||
const system = config === null || config === void 0 ? void 0 : config.system; | ||
return new (ctor || AuthClient)(tenantId, { auth, cache, system }); | ||
}; | ||
export default createAuthClient; | ||
//# sourceMappingURL=create-auth-client.js.map |
import { Logger, LogLevel } from '@azure/msal-browser'; | ||
/** | ||
* MSAL client logger for development, production should use telemetry | ||
* | ||
* @example | ||
* ```typescript | ||
* client.setLogger(new ConsoleLogger()); | ||
* ``` | ||
*/ | ||
export class ConsoleLogger extends Logger { | ||
/** | ||
* @param logLevel - 0-1-2-3 (error-warning-info-debug) if not provided all records logged | ||
*/ | ||
constructor(logLevel) { | ||
@@ -8,2 +19,5 @@ super({ | ||
}); | ||
/** | ||
* Map log level to console log function type | ||
*/ | ||
this.getLogType = (lvl) => { | ||
@@ -23,2 +37,3 @@ switch (lvl) { | ||
} | ||
/** @inheritdoc */ | ||
loggerCallback(lvl, msg, _containsPii) { | ||
@@ -25,0 +40,0 @@ console[this.getLogType(lvl)](`%c FUSION::MSAL %c %s`, 'border: 1px solid;', 'border: none;', msg); |
@@ -0,1 +1,11 @@ | ||
/** | ||
* Redirects browser to provided location | ||
* If not redirected by provided timeout, promise is rejected | ||
* | ||
* @internal | ||
* | ||
* @param url - endpoint to navigate to | ||
* @param timeout - max wait before redirect | ||
* @param history - append navigation to history | ||
*/ | ||
export const redirect = (url, timeout = 3000, history) => { | ||
@@ -2,0 +12,0 @@ history ? window.location.assign(url) : window.location.replace(url); |
@@ -0,1 +1,10 @@ | ||
/** | ||
* Creates and normalizes redirect uri. | ||
* Strips double and trailing slashes | ||
* | ||
* @internal | ||
* | ||
* @param uri - relative path or full url | ||
* @param home - base url for relative urls | ||
*/ | ||
export const normalizeUri = (uri, home = window.location.origin) => { | ||
@@ -6,2 +15,7 @@ uri = uri.match(/^http[s]?/) ? uri : home + uri; | ||
}; | ||
/** | ||
* Compares normalized version of urls | ||
* | ||
* @internal | ||
*/ | ||
export const compareOrigin = (a, b) => { | ||
@@ -8,0 +22,0 @@ const url = { a: normalizeUri(a), b: normalizeUri(b) }; |
const DEFAULT_CONFIG_KEY = 'default'; | ||
export class AuthConfigurator { | ||
constructor() { | ||
/** internal map of keyed configs */ | ||
this._configs = {}; | ||
@@ -5,0 +6,0 @@ this.requiresAuth = true; |
@@ -0,1 +1,5 @@ | ||
/** | ||
* [[include:module-msal/README.MD]] | ||
* @module | ||
*/ | ||
export * from './configurator'; | ||
@@ -2,0 +6,0 @@ export * from './provider'; |
@@ -17,3 +17,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const configurator = new AuthConfigurator(); | ||
/** check if parent scope has configured msal */ | ||
if ((_a = refModules === null || refModules === void 0 ? void 0 : refModules.auth) === null || _a === void 0 ? void 0 : _a.defaultConfig) { | ||
/** copy configuration from parent scope */ | ||
configurator.configureDefault(refModules.auth.defaultConfig); | ||
@@ -34,2 +36,19 @@ } | ||
}; | ||
/** | ||
* Enable MSAL module | ||
* | ||
* @example | ||
```ts | ||
configureMsal( | ||
{ | ||
tenantId: '{TENANT_ID}', | ||
clientId: '{CLIENT_ID}', | ||
redirectUri: '/authentication/login-callback', | ||
}, | ||
// requires authenticated user when module is initialized (force login) | ||
{ requiresAuth: true } | ||
); | ||
``` | ||
* @param defaultClient - default auth client for the module | ||
*/ | ||
export const configureMsal = (defaultClient, args) => ({ | ||
@@ -36,0 +55,0 @@ module, |
@@ -38,2 +38,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const client = createAuthClient(config.tenantId, config.clientId, config.redirectUri, config.config); | ||
// TODO - fix with log streamer | ||
client.setLogger(new ConsoleLogger(0)); | ||
@@ -49,7 +50,4 @@ return client; | ||
const { requestOrigin } = client; | ||
const res = yield client.handleRedirectPromise(); | ||
if ((res === null || res === void 0 ? void 0 : res.state) !== 'internal') { | ||
return null; | ||
} | ||
else if (requestOrigin === redirectUri) { | ||
yield client.handleRedirectPromise(); | ||
if (requestOrigin === redirectUri) { | ||
logger.warning(`detected callback loop from url ${redirectUri}, redirecting to root`); | ||
@@ -76,6 +74,3 @@ window.location.replace('/'); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.defaultClient.login({ | ||
state: window.parent === window ? 'internal' : 'external', | ||
scopes: [], | ||
}); | ||
yield this.defaultClient.login(); | ||
}); | ||
@@ -82,0 +77,0 @@ } |
@@ -1,2 +0,3 @@ | ||
export const version = '3.1.0'; | ||
// Generated by genversion. | ||
export const version = '3.1.5'; | ||
//# sourceMappingURL=version.js.map |
@@ -0,2 +1,13 @@ | ||
/** | ||
* - **Popup:** | ||
* Use when initiating the process via opening a popup window in the user's browser | ||
* | ||
* - **Redirect:** | ||
* Use when initiating the login process by redirecting the user's browser to the authorization endpoint. | ||
* This function redirects the page, so any code that follows this function will not execute. | ||
*/ | ||
export type AuthBehavior = 'popup' | 'redirect'; | ||
/** | ||
* Default behavior for login and acquisition of token | ||
*/ | ||
export declare const defaultBehavior: AuthBehavior; |
@@ -11,13 +11,80 @@ import { PublicClientApplication, Configuration, AuthenticationResult, AccountInfo as AccountInfoBase } from '@azure/msal-browser'; | ||
}; | ||
/** | ||
* ### Simple extension of Microsoft`s authentication client. | ||
* | ||
* When using this client tenant is **required** since common login is deprecated after all. | ||
* By providing tenant the user account can simple be extracted from current session *if any*. | ||
* | ||
* @example | ||
* ```typescript | ||
* const tenantId = '224123a0d-7990-4ba1-aff3-1dss9569af32'; | ||
* const authPath = '/my-app/auth'; | ||
* const client = new AuthClient(tenantId, { | ||
* auth: { | ||
* clientId: '6dab35d4-59ff-4dcc-3356-24479e6fc888', | ||
* authority: `https://login.microsoftonline.com/${tenantId}`, | ||
* redirectUri: window.location.origin + '/my-app/auth' | ||
* } | ||
* }); | ||
* document.getElementById('login-btn').addEventListener('click', () => | ||
* client.login({ scopes: ['data.read'] }) | ||
* .then(console.log) | ||
* .catch(console.error) | ||
* ); | ||
* (async() => { | ||
* if(window.location.path === authPath) { | ||
* await client.handleRedirectPromise() | ||
* } | ||
* )(); | ||
* ``` | ||
* @see [Microsoft Authentication Library](https://github.com/AzureAD/microsoft-authentication-library-for-js) | ||
* @see [Microsoft identity platform](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow) | ||
*/ | ||
export declare class AuthClient extends PublicClientApplication { | ||
#private; | ||
readonly tenantId: string; | ||
/** | ||
* @returns | ||
* Returns account for client tenant that MSAL currently has data for. | ||
* (the account object is created at the time of successful login) | ||
*/ | ||
get account(): AccountInfo | undefined; | ||
get hasValidClaims(): boolean; | ||
/** | ||
* @returns - Configured client id | ||
*/ | ||
get clientId(): string | undefined; | ||
get requestOrigin(): string | null; | ||
constructor(tenantId: string, config: Configuration, behavior?: AuthBehavior); | ||
/** | ||
* @param tenantId - tenant id for client domain | ||
* @param config - required [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/src/config/Configuration.ts) | ||
*/ | ||
constructor(tenantId: string, config: Configuration); | ||
/** | ||
* @param silent | ||
* Attempt to use a hidden iframe to fetch an authorization code from the eSTS if {@link AuthClient.account} or login hint. | ||
* Provided {@link AuthBehavior} is used as fallback. | ||
* There are cases where this may not work: | ||
* - Any browser using a form of Intelligent Tracking Prevention | ||
* - If there is not an established session with the service | ||
* | ||
* @returns | ||
* Promise that is fulfilled when this function has completed, or rejected if an error was raised. | ||
*/ | ||
login(options?: AuthRequest, behavior?: AuthBehavior, silent?: boolean): Promise<AuthenticationResult | void>; | ||
/** | ||
* Will try to silently acquire an access token for a given set of scopes. | ||
* Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token. | ||
* | ||
* @param silent | ||
* Attempt to use a hidden iframe to fetch an authorization code from the eSTS if {@link AuthClient.account} or login hint. | ||
* Provided {@link AuthBehavior} is used as fallback. | ||
* There are cases where this may not work: | ||
* - Any browser using a form of Intelligent Tracking Prevention | ||
* - If there is not an established session with the service | ||
* | ||
* @returns | ||
* Promise that is fulfilled when this function has completed, or rejected if an error was raised. | ||
*/ | ||
acquireToken(options?: AuthRequest, behavior?: AuthBehavior, silent?: boolean): Promise<AuthenticationResult | void>; | ||
} | ||
export default AuthClient; |
import { Configuration, IPublicClientApplication } from '@azure/msal-browser'; | ||
import { AuthClient } from './client'; | ||
import { AuthBehavior } from './behavior'; | ||
export type AuthClientConfig = Omit<Configuration, 'auth'> & { | ||
auth?: Partial<Configuration['auth']>; | ||
behavior?: AuthBehavior; | ||
export type AuthClientConfig = Configuration & { | ||
auth: Partial<Configuration['auth']>; | ||
}; | ||
export declare const createAuthClient: <T extends IPublicClientApplication = AuthClient>(tenantId: string, clientId: string, redirectUri?: string, config?: AuthClientConfig, ctor?: (new (tenantId: string, config: Configuration, defaultBehavior?: AuthBehavior) => T) | undefined) => T; | ||
/** | ||
* Creates an authentication client with basic config. | ||
* | ||
* @example | ||
* ```typescript | ||
* const myClient = createClient( | ||
* '224123a0d-7990-4ba1-aff3-1dss9569af32', | ||
* '6dab35d4-59ff-4dcc-3356-24479e6fc888', | ||
* '/my-app/auth' | ||
* ); | ||
* ``` | ||
* | ||
* @template T - client type, default to {@link AuthClient} | ||
* | ||
* @param tenantId - tenant to for authentication | ||
* @param clientId - client id for authentication | ||
* @param redirectUri - callback url for authentication (must match exact configured url in app) | ||
* @param config - optional [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/src/config/Configuration.ts) | ||
* @param ctor - optional client class | ||
*/ | ||
export declare const createAuthClient: <T extends IPublicClientApplication = AuthClient>(tenantId: string, clientId: string, redirectUri?: string, config?: AuthClientConfig, ctor?: new (tenantId: string, config: Configuration) => T) => T; | ||
export default createAuthClient; |
import { Logger, LogLevel } from '@azure/msal-browser'; | ||
/** | ||
* Logger functions of {@link Console} | ||
*/ | ||
type ConsoleLevel = 'error' | 'warn' | 'info' | 'debug'; | ||
/** | ||
* MSAL client logger for development, production should use telemetry | ||
* | ||
* @example | ||
* ```typescript | ||
* client.setLogger(new ConsoleLogger()); | ||
* ``` | ||
*/ | ||
export declare class ConsoleLogger extends Logger { | ||
/** | ||
* @param logLevel - 0-1-2-3 (error-warning-info-debug) if not provided all records logged | ||
*/ | ||
constructor(logLevel?: LogLevel); | ||
/** @inheritdoc */ | ||
protected loggerCallback(lvl: LogLevel, msg: string, _containsPii?: boolean): void; | ||
/** | ||
* Map log level to console log function type | ||
*/ | ||
protected getLogType: (lvl: LogLevel) => ConsoleLevel; | ||
} | ||
export default ConsoleLogger; |
import { PopupRequest, RedirectRequest } from '@azure/msal-browser'; | ||
/** | ||
* Request object passed by user to retrieve a Code from the | ||
* server (first leg of authorization code grant flow). | ||
* | ||
* **scopes**\ | ||
* Array of scopes the application is requesting access to. | ||
* | ||
* **authority**\ | ||
* Url of the authority which the application acquires tokens from. | ||
* | ||
* **correlationId**\ | ||
* Unique GUID set per request to trace a request end-to-end for telemetry purposes. | ||
* | ||
* **redirectUri**\ | ||
* The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal. | ||
* | ||
* **extraScopesToConsent**\ | ||
* Scopes for a different resource when the user needs consent upfront. | ||
* | ||
* **responseMode**\ | ||
* Specifies the method that should be used to send the authentication result to your app. Fragment is the only valid option for msal-browser. | ||
* | ||
* **codeChallenge**\ | ||
* Used to secure authorization code grant via Proof of Key for Code Exchange (PKCE). For more information, see the PKCE RCF:https://tools.ietf.org/html/rfc7636 | ||
* | ||
* **codeChallengeMethod**\ | ||
* The method used to encode the code verifier for the code challenge parameter. Can be "plain" or "S256". If excluded, code challenge is assumed to be plaintext. For more information, see the PKCE RCF: https://tools.ietf.org/html/rfc7636 | ||
* | ||
* **state**\ | ||
* A value included in the request that is also returned in the token response. A randomly generated unique value is typically used for preventing cross site request forgery attacks. The state is also used to encode information about the user's state in the app before the authentication request occurred. | ||
* | ||
* **prompt**\ | ||
* Indicates the type of user interaction that is required. | ||
* - login: will force the user to enter their credentials on that request, negating single-sign on | ||
* - none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error | ||
* - consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app | ||
* - select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account | ||
* | ||
* **loginHint**\ | ||
* Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the preferred_username claim. | ||
* | ||
* **sid**\ | ||
* Session ID, unique identifier for the session. Available as an optional claim on ID tokens. | ||
* | ||
* **domainHint**\ | ||
* Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant. | ||
* | ||
* **extraQueryParameters**\ | ||
* String to string map of custom query parameters. | ||
* | ||
* **claims**\ | ||
* In cases where Azure AD tenant admin has enabled conditional access policies, and the policy has not been met, exceptions will contain claims that need to be consented to. | ||
* | ||
* **nonce**\ | ||
* A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks. | ||
* | ||
* **redirectStartPage**\ | ||
* The page that should be returned to after loginRedirect or acquireTokenRedirect. | ||
* This should only be used if this is different from the redirectUri and will default to the page that initiates the request. | ||
* When the navigateToLoginRequestUrl config option is set to false this parameter will be ignored. | ||
* | ||
* @see [microsoft-authentication-library-for-js](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser/src/request) | ||
*/ | ||
export type AuthRequest = PopupRequest | RedirectRequest; |
@@ -9,5 +9,21 @@ import { AuthClientConfig } from './client'; | ||
export interface IAuthConfigurator { | ||
/** | ||
* get default configuration for module | ||
*/ | ||
readonly defaultConfig: AuthClientOptions | undefined; | ||
/** | ||
* Get named config by key | ||
* @param name key for config | ||
*/ | ||
getClientConfig(name: string): AuthClientOptions; | ||
/** | ||
* Create named config | ||
* @param name key for config | ||
* @param options config options | ||
*/ | ||
configureClient(name: string, options: AuthClientOptions): AuthConfigurator; | ||
/** | ||
* Create default module config | ||
* @param options config options | ||
*/ | ||
configureDefault(options: AuthClientOptions): void; | ||
@@ -17,2 +33,3 @@ requiresAuth: boolean; | ||
export declare class AuthConfigurator implements IAuthConfigurator { | ||
/** internal map of keyed configs */ | ||
protected _configs: Record<string, AuthClientOptions>; | ||
@@ -19,0 +36,0 @@ requiresAuth: boolean; |
@@ -0,1 +1,5 @@ | ||
/** | ||
* [[include:module-msal/README.MD]] | ||
* @module | ||
*/ | ||
export * from './configurator'; | ||
@@ -2,0 +6,0 @@ export * from './provider'; |
@@ -6,2 +6,19 @@ import { AuthClientOptions, IAuthConfigurator } from './configurator'; | ||
export declare const module: MsalModule; | ||
/** | ||
* Enable MSAL module | ||
* | ||
* @example | ||
```ts | ||
configureMsal( | ||
{ | ||
tenantId: '{TENANT_ID}', | ||
clientId: '{CLIENT_ID}', | ||
redirectUri: '/authentication/login-callback', | ||
}, | ||
// requires authenticated user when module is initialized (force login) | ||
{ requiresAuth: true } | ||
); | ||
``` | ||
* @param defaultClient - default auth client for the module | ||
*/ | ||
export declare const configureMsal: (defaultClient: AuthClientOptions, args?: { | ||
@@ -8,0 +25,0 @@ clients?: Record<string, AuthClientOptions>; |
@@ -15,7 +15,28 @@ import { AuthClient, AuthRequest } from './client'; | ||
readonly defaultAccount: AccountInfo | undefined; | ||
/** | ||
* Get auth client by registered config name | ||
*/ | ||
getClient(name: string): AuthClient; | ||
/** | ||
* Create auth client by registered config name | ||
* @param name name of configured client, default to defaultConfig {@link IAuthConfigurator.configureDefault} | ||
*/ | ||
createClient(name?: string): AuthClient; | ||
/** | ||
* Acquire token from default auth client | ||
* @param req Auth request options | ||
*/ | ||
acquireToken(req: AuthRequest): ReturnType<AuthClient['acquireToken']>; | ||
/** | ||
* Acquire access token from default auth client | ||
* @param req Auth request options | ||
*/ | ||
acquireAccessToken(req: AuthRequest): Promise<string | undefined>; | ||
/** | ||
* Login to default auth client | ||
*/ | ||
login(): Promise<void>; | ||
/** | ||
* Handle default client redirect callback | ||
*/ | ||
handleRedirect(): ReturnType<AuthClient['handleRedirectPromise']>; | ||
@@ -22,0 +43,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare const version = "3.1.0"; | ||
export declare const version = "3.1.5"; |
{ | ||
"name": "@equinor/fusion-framework-module-msal", | ||
"version": "3.2.0-msal-a48dcfe523e40243313637b31b0dc70d1b1ddc47", | ||
"version": "4.0.0-next-663bed8344cc2ca0111705b05045173328b3104d", | ||
"description": "", | ||
"main": "dist/esm/index.js", | ||
"type": "module", | ||
"exports": { | ||
@@ -37,6 +38,6 @@ ".": { | ||
"@azure/msal-browser": "^2.21.0", | ||
"@equinor/fusion-framework-module": "^4.3.0" | ||
"@equinor/fusion-framework-module": "^5.0.0-next-663bed8344cc2ca0111705b05045173328b3104d" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.4.2" | ||
"typescript": "^5.5.4" | ||
}, | ||
@@ -43,0 +44,0 @@ "scripts": { |
@@ -88,4 +88,2 @@ import { | ||
#behavior: AuthBehavior; | ||
/** | ||
@@ -98,6 +96,4 @@ * @param tenantId - tenant id for client domain | ||
config: Configuration, | ||
behavior: AuthBehavior = defaultBehavior, | ||
) { | ||
super(config); | ||
this.#behavior = behavior; | ||
} | ||
@@ -118,3 +114,3 @@ | ||
options?: AuthRequest, | ||
behavior: AuthBehavior = this.#behavior, | ||
behavior: AuthBehavior = defaultBehavior, | ||
silent = true, | ||
@@ -163,3 +159,3 @@ ): Promise<AuthenticationResult | void> { | ||
options: AuthRequest = { scopes: [] }, | ||
behavior: AuthBehavior = this.#behavior, | ||
behavior: AuthBehavior = defaultBehavior, | ||
silent = true, | ||
@@ -166,0 +162,0 @@ ): Promise<AuthenticationResult | void> { |
import { Configuration, IPublicClientApplication } from '@azure/msal-browser'; | ||
import { AuthClient } from './client'; | ||
import { normalizeUri } from './util/url'; | ||
import { AuthBehavior } from './behavior'; | ||
export type AuthClientConfig = Omit<Configuration, 'auth'> & { | ||
auth?: Partial<Configuration['auth']>; | ||
behavior?: AuthBehavior; | ||
export type AuthClientConfig = Configuration & { | ||
auth: Partial<Configuration['auth']>; | ||
}; | ||
@@ -36,3 +34,3 @@ | ||
config?: AuthClientConfig, | ||
ctor?: new (tenantId: string, config: Configuration, defaultBehavior?: AuthBehavior) => T, | ||
ctor?: new (tenantId: string, config: Configuration) => T, | ||
): T => { | ||
@@ -47,6 +45,6 @@ const auth: Configuration['auth'] = { | ||
const cache = { cacheLocation: 'localStorage', ...config?.cache }; | ||
const { behavior, system } = config ?? {}; | ||
return new (ctor || AuthClient)(tenantId, { auth, cache, system }, behavior) as T; | ||
const system = config?.system; | ||
return new (ctor || AuthClient)(tenantId, { auth, cache, system }) as T; | ||
}; | ||
export default createAuthClient; |
@@ -101,9 +101,4 @@ import { AuthClient, createAuthClient, AuthRequest, ConsoleLogger } from './client'; | ||
const res = await client.handleRedirectPromise(); | ||
// if not internal state, do not redirect (state will not be included when popup was created from iframe) | ||
if (res?.state !== 'internal') { | ||
return null; | ||
} else if (requestOrigin === redirectUri) { | ||
// prevent redirect loop | ||
await client.handleRedirectPromise(); | ||
if (requestOrigin === redirectUri) { | ||
logger.warning( | ||
@@ -114,3 +109,2 @@ `detected callback loop from url ${redirectUri}, redirecting to root`, | ||
} else { | ||
// either redirect to origin or root | ||
window.location.replace(requestOrigin || '/'); | ||
@@ -132,7 +126,4 @@ } | ||
async login(): Promise<void> { | ||
await this.defaultClient.login({ | ||
state: window.parent === window ? 'internal' : 'external', | ||
scopes: [], | ||
}); | ||
await this.defaultClient.login(); | ||
} | ||
} |
// Generated by genversion. | ||
export const version = '3.1.0'; | ||
export const version = '3.1.5'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204921
1447
Yes