@genesislcap/foundation-auth 14.124.0 → 14.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/dts/machine/machine.d.ts +31 -0
- package/dist/dts/machine/machine.d.ts.map +1 -1
- package/dist/dts/store/auth.d.ts +16 -0
- package/dist/dts/store/auth.d.ts.map +1 -1
- package/dist/esm/machine/machine.js +33 -0
- package/dist/esm/store/auth.js +19 -0
- package/dist/foundation-auth.api.json +58 -0
- package/dist/foundation-auth.d.ts +49 -0
- package/docs/api/foundation-auth.getauthmachine.md +45 -0
- package/docs/api/foundation-auth.getauthstore.md +30 -0
- package/docs/api/foundation-auth.md +2 -0
- package/docs/api-report.md +6 -0
- package/package.json +19 -12
package/README.md
CHANGED
|
@@ -20,6 +20,9 @@ not limited to:
|
|
|
20
20
|
* `AuthRouting`: A routing utility, which you can call `navigateTo(...)` to navigate to internal routes.
|
|
21
21
|
* Various UI components / route screens, some of which are lazy loaded on-demand to optimise the experience.
|
|
22
22
|
|
|
23
|
+
For applications that do not or cannot use the DI system, we export utility functions to get each from the DI container.
|
|
24
|
+
For example, `getUser`, `getAuthStore`, `getAuthMachine`, `getAuthRouting` etc.
|
|
25
|
+
|
|
23
26
|
Many of these are available as [subpath exports](https://nodejs.org/api/packages.html#subpath-exports) and should be
|
|
24
27
|
imported from these to optimise bundling and overall efficiency.
|
|
25
28
|
|
|
@@ -43,7 +46,7 @@ These examples are based on a host application using [FAST](https://www.fast.des
|
|
|
43
46
|
choice should be quite similar.
|
|
44
47
|
|
|
45
48
|
## Environment variables
|
|
46
|
-
`foundation-auth` uses the following environment variables. The `.env` file below shows the built-in defaults used
|
|
49
|
+
`foundation-auth` uses the following environment variables. The `.env` file below shows the built-in defaults used with `API_HOST`.
|
|
47
50
|
|
|
48
51
|
```dotenv
|
|
49
52
|
# There should be nothing sensitive here!
|
|
@@ -77,7 +80,7 @@ config(); // < loads the .env vars
|
|
|
77
80
|
module.exports = {
|
|
78
81
|
...
|
|
79
82
|
plugins: [
|
|
80
|
-
new DefinePlugin(resolveDefineConfig(['GENX_*'])), // < code replacement
|
|
83
|
+
new DefinePlugin(resolveDefineConfig(['GENX_*'])), // < code replacement should include 'API_HOST' if set, ie. ['GENX_*', 'API_HOST', ...]
|
|
81
84
|
],
|
|
82
85
|
}
|
|
83
86
|
```
|
|
@@ -92,9 +95,9 @@ import { User } from '@genesislcap/foundation-auth/user';
|
|
|
92
95
|
|
|
93
96
|
...or via a utility if your app is not using decorators or the DI container.
|
|
94
97
|
```ts
|
|
95
|
-
import { getUser
|
|
98
|
+
import { getUser } from '@genesislcap/foundation-auth/user';
|
|
96
99
|
...
|
|
97
|
-
private user
|
|
100
|
+
private user = getUser();
|
|
98
101
|
```
|
|
99
102
|
|
|
100
103
|
User properties are decorated with `@observable`, meaning in FAST terms it's reactive, and you can bind to properties
|
|
@@ -105,7 +108,7 @@ an event listener.
|
|
|
105
108
|
import type { UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';
|
|
106
109
|
...
|
|
107
110
|
const unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
108
|
-
console.log('User authenticated?', event.detail); // <
|
|
111
|
+
console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated
|
|
109
112
|
});
|
|
110
113
|
```
|
|
111
114
|
|
|
@@ -62,4 +62,35 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
62
62
|
* @internal
|
|
63
63
|
*/
|
|
64
64
|
export declare const AuthMachine: import("@microsoft/fast-foundation").InterfaceSymbol<AuthMachine>;
|
|
65
|
+
/**
|
|
66
|
+
* Get AuthMachine from the DI container.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { getAuthMachine } from '@genesislcap/foundation-auth/machine';
|
|
74
|
+
* import { getUser, UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';
|
|
75
|
+
* ...
|
|
76
|
+
* private authMachine = getAuthMachine();
|
|
77
|
+
* ...
|
|
78
|
+
* private user = getUser();
|
|
79
|
+
* private unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
80
|
+
* console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated
|
|
81
|
+
* });
|
|
82
|
+
* ...
|
|
83
|
+
* this.authMachine.send({
|
|
84
|
+
* type: 'login',
|
|
85
|
+
* params: {
|
|
86
|
+
* type: CredentialType.BASIC,
|
|
87
|
+
* username: 'JohnWick',
|
|
88
|
+
* password: '***********',
|
|
89
|
+
* },
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export declare function getAuthMachine(): AuthMachine;
|
|
65
96
|
//# sourceMappingURL=machine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAEL,iBAAiB,EAIlB,MAAM,eAAe,CAAC;AAYvB,OAAO,EACL,iBAAiB,EAQlB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,KAAK,EACV,kBAAkB,EAClB,g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E,GAAG,KAAK,GAAG,iBAAiB;IAgB3E,SAAS,CAAC,YAAY;;;;;;;;;;;;;;;;;MAoBpB;IAEF,SAAS,CAAC,aAAa;;;MAGpB;CACJ;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,mEAA0E,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
package/dist/dts/store/auth.d.ts
CHANGED
|
@@ -77,5 +77,21 @@ export declare class DefaultAuthStore extends AbstractStoreRoot<AuthStore, AuthE
|
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
79
|
export declare const AuthStore: import("@microsoft/fast-foundation").InterfaceSymbol<AuthStore>;
|
|
80
|
+
/**
|
|
81
|
+
* Get AuthStore from the DI container.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { getAuthStore } from '@genesislcap/foundation-auth/store';
|
|
89
|
+
* ...
|
|
90
|
+
* private authStore = getAuthStore();
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export declare function getAuthStore(): AuthStore;
|
|
80
96
|
export {};
|
|
81
97
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/store/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACL,iBAAiB,EAEjB,SAAS,EACT,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/store/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CA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,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzC,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;IACjE,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;IACjE,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC;CAChE;AAED;;;GAGG;AACH,qBAAa,gBACX,SAAQ,iBAAiB,CAAC,SAAS,EAAE,YAAY,EAAE,oBAAoB,CACvE,YAAW,SAAS;IAGN,QAAQ,CAAC,MAAM,EAAE,UAAU;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,kBAAkB;gBAFrC,MAAM,EAAE,UAAU,EACjB,WAAW,EAAE,WAAW,EACjB,SAAS,EAAE,kBAAkB;IAK5D,wCAAwC;IACxC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,6CAA6C;IAC7C,cAAc,gBAGZ;IAEF,sCAAsC;IACtC,OAAO,gBAKL;IAEF,uCAAuC;IACvC,QAAQ,gBAAuF;IAE/F,+CAA+C;IAC/C,gBAAgB,gBAKd;IAEF,+CAA+C;IAC/C,gBAAgB,gBAKd;IAEF,8CAA8C;IAC9C,eAAe,gBAKb;IAEF,2CAA2C;IAC3C,IAAI,YAAY,aAEf;IAED,4CAA4C;IAC5C,IAAI,aAAa,aAShB;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,iEAA0D,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC"}
|
|
@@ -666,3 +666,36 @@ export { DefaultAuthMachine };
|
|
|
666
666
|
* @internal
|
|
667
667
|
*/
|
|
668
668
|
export const AuthMachine = DI.createInterface((x) => x.singleton(DefaultAuthMachine));
|
|
669
|
+
/**
|
|
670
|
+
* Get AuthMachine from the DI container.
|
|
671
|
+
*
|
|
672
|
+
* @remarks
|
|
673
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```ts
|
|
677
|
+
* import { getAuthMachine } from '@genesislcap/foundation-auth/machine';
|
|
678
|
+
* import { getUser, UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';
|
|
679
|
+
* ...
|
|
680
|
+
* private authMachine = getAuthMachine();
|
|
681
|
+
* ...
|
|
682
|
+
* private user = getUser();
|
|
683
|
+
* private unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
684
|
+
* console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated
|
|
685
|
+
* });
|
|
686
|
+
* ...
|
|
687
|
+
* this.authMachine.send({
|
|
688
|
+
* type: 'login',
|
|
689
|
+
* params: {
|
|
690
|
+
* type: CredentialType.BASIC,
|
|
691
|
+
* username: 'JohnWick',
|
|
692
|
+
* password: '***********',
|
|
693
|
+
* },
|
|
694
|
+
* });
|
|
695
|
+
* ```
|
|
696
|
+
*
|
|
697
|
+
* @public
|
|
698
|
+
*/
|
|
699
|
+
export function getAuthMachine() {
|
|
700
|
+
return DI.getOrCreateDOMContainer().get(AuthMachine);
|
|
701
|
+
}
|
package/dist/esm/store/auth.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from "tslib";
|
|
2
2
|
import { AbstractStoreRoot, registerStore, } from '@genesislcap/foundation-store';
|
|
3
|
+
import { DI } from '@microsoft/fast-foundation';
|
|
3
4
|
import { AuthConfig } from '../config/config';
|
|
4
5
|
import { AuthMachine } from '../machine/machine';
|
|
5
6
|
import { AuthFormEntryStore } from './authFormEntry';
|
|
@@ -69,3 +70,21 @@ export { DefaultAuthStore };
|
|
|
69
70
|
* @internal
|
|
70
71
|
*/
|
|
71
72
|
export const AuthStore = registerStore(DefaultAuthStore, 'AuthStore');
|
|
73
|
+
/**
|
|
74
|
+
* Get AuthStore from the DI container.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { getAuthStore } from '@genesislcap/foundation-auth/store';
|
|
82
|
+
* ...
|
|
83
|
+
* private authStore = getAuthStore();
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export function getAuthStore() {
|
|
89
|
+
return DI.getOrCreateDOMContainer().get(AuthStore);
|
|
90
|
+
}
|
|
@@ -10524,6 +10524,64 @@
|
|
|
10524
10524
|
"endIndex": 5
|
|
10525
10525
|
}
|
|
10526
10526
|
},
|
|
10527
|
+
{
|
|
10528
|
+
"kind": "Function",
|
|
10529
|
+
"canonicalReference": "@genesislcap/foundation-auth!getAuthMachine:function(1)",
|
|
10530
|
+
"docComment": "/**\n * Get AuthMachine from the DI container.\n *\n * @remarks\n *\n * A utility method for host applications that are not using decorators or the DI container.\n *\n * @example\n * ```ts\n * import { getAuthMachine } from '@genesislcap/foundation-auth/machine';\n * import { getUser, UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';\n * ...\n * private authMachine = getAuthMachine();\n * ...\n * private user = getUser();\n * private unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {\n * console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated\n * });\n * ...\n * this.authMachine.send({\n * type: 'login',\n * params: {\n * type: CredentialType.BASIC,\n * username: 'JohnWick',\n * password: '***********',\n * },\n * });\n * ```\n *\n * @public\n */\n",
|
|
10531
|
+
"excerptTokens": [
|
|
10532
|
+
{
|
|
10533
|
+
"kind": "Content",
|
|
10534
|
+
"text": "export declare function getAuthMachine(): "
|
|
10535
|
+
},
|
|
10536
|
+
{
|
|
10537
|
+
"kind": "Reference",
|
|
10538
|
+
"text": "AuthMachine",
|
|
10539
|
+
"canonicalReference": "@genesislcap/foundation-auth!AuthMachine:interface"
|
|
10540
|
+
},
|
|
10541
|
+
{
|
|
10542
|
+
"kind": "Content",
|
|
10543
|
+
"text": ";"
|
|
10544
|
+
}
|
|
10545
|
+
],
|
|
10546
|
+
"fileUrlPath": "src/machine/machine.ts",
|
|
10547
|
+
"returnTypeTokenRange": {
|
|
10548
|
+
"startIndex": 1,
|
|
10549
|
+
"endIndex": 2
|
|
10550
|
+
},
|
|
10551
|
+
"releaseTag": "Public",
|
|
10552
|
+
"overloadIndex": 1,
|
|
10553
|
+
"parameters": [],
|
|
10554
|
+
"name": "getAuthMachine"
|
|
10555
|
+
},
|
|
10556
|
+
{
|
|
10557
|
+
"kind": "Function",
|
|
10558
|
+
"canonicalReference": "@genesislcap/foundation-auth!getAuthStore:function(1)",
|
|
10559
|
+
"docComment": "/**\n * Get AuthStore from the DI container.\n *\n * @remarks\n *\n * A utility method for host applications that are not using decorators or the DI container.\n *\n * @example\n * ```ts\n * import { getAuthStore } from '@genesislcap/foundation-auth/store';\n * ...\n * private authStore = getAuthStore();\n * ```\n *\n * @public\n */\n",
|
|
10560
|
+
"excerptTokens": [
|
|
10561
|
+
{
|
|
10562
|
+
"kind": "Content",
|
|
10563
|
+
"text": "export declare function getAuthStore(): "
|
|
10564
|
+
},
|
|
10565
|
+
{
|
|
10566
|
+
"kind": "Reference",
|
|
10567
|
+
"text": "AuthStore",
|
|
10568
|
+
"canonicalReference": "@genesislcap/foundation-auth!AuthStore:interface"
|
|
10569
|
+
},
|
|
10570
|
+
{
|
|
10571
|
+
"kind": "Content",
|
|
10572
|
+
"text": ";"
|
|
10573
|
+
}
|
|
10574
|
+
],
|
|
10575
|
+
"fileUrlPath": "src/store/auth.ts",
|
|
10576
|
+
"returnTypeTokenRange": {
|
|
10577
|
+
"startIndex": 1,
|
|
10578
|
+
"endIndex": 2
|
|
10579
|
+
},
|
|
10580
|
+
"releaseTag": "Public",
|
|
10581
|
+
"overloadIndex": 1,
|
|
10582
|
+
"parameters": [],
|
|
10583
|
+
"name": "getAuthStore"
|
|
10584
|
+
},
|
|
10527
10585
|
{
|
|
10528
10586
|
"kind": "TypeAlias",
|
|
10529
10587
|
"canonicalReference": "@genesislcap/foundation-auth!GetCredentialOptions:type",
|
|
@@ -1788,6 +1788,55 @@ export declare const fromDTOStringArray: (arr: string[]) => string[];
|
|
|
1788
1788
|
*/
|
|
1789
1789
|
export declare const fromIDPDTO: (dto: IDENTITY_PROVIDER) => IdentityProvider;
|
|
1790
1790
|
|
|
1791
|
+
/**
|
|
1792
|
+
* Get AuthMachine from the DI container.
|
|
1793
|
+
*
|
|
1794
|
+
* @remarks
|
|
1795
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
1796
|
+
*
|
|
1797
|
+
* @example
|
|
1798
|
+
* ```ts
|
|
1799
|
+
* import { getAuthMachine } from '@genesislcap/foundation-auth/machine';
|
|
1800
|
+
* import { getUser, UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';
|
|
1801
|
+
* ...
|
|
1802
|
+
* private authMachine = getAuthMachine();
|
|
1803
|
+
* ...
|
|
1804
|
+
* private user = getUser();
|
|
1805
|
+
* private unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
1806
|
+
* console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated
|
|
1807
|
+
* });
|
|
1808
|
+
* ...
|
|
1809
|
+
* this.authMachine.send({
|
|
1810
|
+
* type: 'login',
|
|
1811
|
+
* params: {
|
|
1812
|
+
* type: CredentialType.BASIC,
|
|
1813
|
+
* username: 'JohnWick',
|
|
1814
|
+
* password: '***********',
|
|
1815
|
+
* },
|
|
1816
|
+
* });
|
|
1817
|
+
* ```
|
|
1818
|
+
*
|
|
1819
|
+
* @public
|
|
1820
|
+
*/
|
|
1821
|
+
export declare function getAuthMachine(): AuthMachine;
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Get AuthStore from the DI container.
|
|
1825
|
+
*
|
|
1826
|
+
* @remarks
|
|
1827
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* ```ts
|
|
1831
|
+
* import { getAuthStore } from '@genesislcap/foundation-auth/store';
|
|
1832
|
+
* ...
|
|
1833
|
+
* private authStore = getAuthStore();
|
|
1834
|
+
* ```
|
|
1835
|
+
*
|
|
1836
|
+
* @public
|
|
1837
|
+
*/
|
|
1838
|
+
export declare function getAuthStore(): AuthStore;
|
|
1839
|
+
|
|
1791
1840
|
/**
|
|
1792
1841
|
* Represents options for retrieving credentials.
|
|
1793
1842
|
* @public
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-auth](./foundation-auth.md) > [getAuthMachine](./foundation-auth.getauthmachine.md)
|
|
4
|
+
|
|
5
|
+
## getAuthMachine() function
|
|
6
|
+
|
|
7
|
+
Get AuthMachine from the DI container.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function getAuthMachine(): AuthMachine;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
[AuthMachine](./foundation-auth.authmachine.md)
|
|
17
|
+
|
|
18
|
+
## Remarks
|
|
19
|
+
|
|
20
|
+
A utility method for host applications that are not using decorators or the DI container.
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { getAuthMachine } from '@genesislcap/foundation-auth/machine';
|
|
27
|
+
import { getUser, UserAuthenticationChangeEvent } from '@genesislcap/foundation-auth/user';
|
|
28
|
+
...
|
|
29
|
+
private authMachine = getAuthMachine();
|
|
30
|
+
...
|
|
31
|
+
private user = getUser();
|
|
32
|
+
private unsubscribeUser = this.user.addAuthenticationChangeListener((event: UserAuthenticationChangeEvent) => {
|
|
33
|
+
console.log('User authenticated?', event.detail); // < boolean === this.user.isAuthenticated
|
|
34
|
+
});
|
|
35
|
+
...
|
|
36
|
+
this.authMachine.send({
|
|
37
|
+
type: 'login',
|
|
38
|
+
params: {
|
|
39
|
+
type: CredentialType.BASIC,
|
|
40
|
+
username: 'JohnWick',
|
|
41
|
+
password: '***********',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-auth](./foundation-auth.md) > [getAuthStore](./foundation-auth.getauthstore.md)
|
|
4
|
+
|
|
5
|
+
## getAuthStore() function
|
|
6
|
+
|
|
7
|
+
Get AuthStore from the DI container.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function getAuthStore(): AuthStore;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
[AuthStore](./foundation-auth.authstore.md)
|
|
17
|
+
|
|
18
|
+
## Remarks
|
|
19
|
+
|
|
20
|
+
A utility method for host applications that are not using decorators or the DI container.
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { getAuthStore } from '@genesislcap/foundation-auth/store';
|
|
27
|
+
...
|
|
28
|
+
private authStore = getAuthStore();
|
|
29
|
+
```
|
|
30
|
+
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
| --- | --- |
|
|
35
35
|
| [configure(config)](./foundation-auth.configure.md) | configure. |
|
|
36
36
|
| [createHTTPHeadersFromDTO(dto, contentType)](./foundation-auth.createhttpheadersfromdto.md) | createHTTPHeadersFromDTO. |
|
|
37
|
+
| [getAuthMachine()](./foundation-auth.getauthmachine.md) | Get AuthMachine from the DI container. |
|
|
38
|
+
| [getAuthStore()](./foundation-auth.getauthstore.md) | Get AuthStore from the DI container. |
|
|
37
39
|
| [getRoutePath(route, hostPath)](./foundation-auth.getroutepath.md) | A utility to get a sub route path taking the host path into account. |
|
|
38
40
|
| [getUser()](./foundation-auth.getuser.md) | Gets User from the DI container. |
|
|
39
41
|
| [isChangePasswordParams(params)](./foundation-auth.ischangepasswordparams.md) | isChangePasswordParams. |
|
package/docs/api-report.md
CHANGED
|
@@ -1011,6 +1011,12 @@ export const fromDTOStringArray: (arr: string[]) => string[];
|
|
|
1011
1011
|
// @public
|
|
1012
1012
|
export const fromIDPDTO: (dto: IDENTITY_PROVIDER) => IdentityProvider;
|
|
1013
1013
|
|
|
1014
|
+
// @public
|
|
1015
|
+
export function getAuthMachine(): AuthMachine;
|
|
1016
|
+
|
|
1017
|
+
// @public
|
|
1018
|
+
export function getAuthStore(): AuthStore;
|
|
1019
|
+
|
|
1014
1020
|
// @public
|
|
1015
1021
|
export type GetCredentialOptions = CredentialRequestOptions & {};
|
|
1016
1022
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-auth",
|
|
3
3
|
"description": "Genesis Foundation Auth",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.125.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-auth.d.ts",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/dts/routes/routing.d.ts",
|
|
37
37
|
"default": "./dist/esm/routes/routing.js"
|
|
38
38
|
},
|
|
39
|
+
"./store": {
|
|
40
|
+
"types": "./dist/dts/store/index.d.ts",
|
|
41
|
+
"default": "./dist/esm/store/index.js"
|
|
42
|
+
},
|
|
39
43
|
"./user": {
|
|
40
44
|
"types": "./dist/dts/user/index.d.ts",
|
|
41
45
|
"default": "./dist/esm/user/index.js"
|
|
@@ -60,6 +64,9 @@
|
|
|
60
64
|
"routing": [
|
|
61
65
|
"./dist/dts/routes/routing.d.ts"
|
|
62
66
|
],
|
|
67
|
+
"store": [
|
|
68
|
+
"./dist/dts/store/index.d.ts"
|
|
69
|
+
],
|
|
63
70
|
"user": [
|
|
64
71
|
"./dist/dts/user/index.d.ts"
|
|
65
72
|
],
|
|
@@ -99,19 +106,19 @@
|
|
|
99
106
|
}
|
|
100
107
|
},
|
|
101
108
|
"devDependencies": {
|
|
102
|
-
"@genesislcap/foundation-testing": "14.
|
|
103
|
-
"@genesislcap/genx": "14.
|
|
109
|
+
"@genesislcap/foundation-testing": "14.125.0",
|
|
110
|
+
"@genesislcap/genx": "14.125.0",
|
|
104
111
|
"rimraf": "^3.0.2"
|
|
105
112
|
},
|
|
106
113
|
"dependencies": {
|
|
107
|
-
"@genesislcap/foundation-comms": "14.
|
|
108
|
-
"@genesislcap/foundation-events": "14.
|
|
109
|
-
"@genesislcap/foundation-logger": "14.
|
|
110
|
-
"@genesislcap/foundation-state-machine": "14.
|
|
111
|
-
"@genesislcap/foundation-store": "14.
|
|
112
|
-
"@genesislcap/foundation-ui": "14.
|
|
113
|
-
"@genesislcap/foundation-utils": "14.
|
|
114
|
-
"@genesislcap/foundation-zero": "14.
|
|
114
|
+
"@genesislcap/foundation-comms": "14.125.0",
|
|
115
|
+
"@genesislcap/foundation-events": "14.125.0",
|
|
116
|
+
"@genesislcap/foundation-logger": "14.125.0",
|
|
117
|
+
"@genesislcap/foundation-state-machine": "14.125.0",
|
|
118
|
+
"@genesislcap/foundation-store": "14.125.0",
|
|
119
|
+
"@genesislcap/foundation-ui": "14.125.0",
|
|
120
|
+
"@genesislcap/foundation-utils": "14.125.0",
|
|
121
|
+
"@genesislcap/foundation-zero": "14.125.0",
|
|
115
122
|
"@microsoft/fast-components": "^2.21.3",
|
|
116
123
|
"@microsoft/fast-element": "^1.7.0",
|
|
117
124
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
@@ -131,5 +138,5 @@
|
|
|
131
138
|
"publishConfig": {
|
|
132
139
|
"access": "public"
|
|
133
140
|
},
|
|
134
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "c59496ce3895b80fa7faf7fb4d2b58b5a64355ba"
|
|
135
142
|
}
|