You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/site/angular-auth-oidc-client/docs/documentation/public-api.md
+102-41
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,23 @@ The most public accessible observables, properties and methods are placed in the
9
9
10
10
## userData$
11
11
12
-
The `userData$` observable provides the information about the user after he has logged in. In case you are running with one configuration it returns the user data as an object depending on what you get back from the secure token server as user data.
13
-
In case you have multiple configs running it returns a `ConfigUserDataResult[]` which holds the `configId` as well as the `userData` in an array.
12
+
The `userData$` observable provides the information about the user after he has logged in. It returns an `UserDataResult` in the following form.
13
+
14
+
```ts
15
+
exportinterfaceUserDataResult {
16
+
userData:any;
17
+
allUserData:ConfigUserDataResult[];
18
+
}
19
+
20
+
exportinterfaceConfigUserDataResult {
21
+
configId:string;
22
+
userData:any;
23
+
}
24
+
```
25
+
26
+
In case you are running with one configuration the `ConfigUserDataResult` contains the user data in the `userData` property and the `ConfigUserData[]` returns the same user data with the `configId` filled in case you need it.
27
+
28
+
In case you are running with multiple configs the `ConfigUserDataResult`s `userData` property is set to `null` and you find your user data per config in the `ConfigUserData[]`.
14
29
15
30
Example:
16
31
@@ -22,68 +37,114 @@ Single Config:
22
37
23
38
```json
24
39
{
25
-
"sub": "...",
26
-
"preferred_username": "john@doe.org",
27
-
"name": "john@doe.org",
28
-
"email": "john@doe.org",
29
-
"email_verified": false,
30
-
"given_name": "john@doe.org",
31
-
"role": "user",
32
-
"amr": "pwd"
40
+
"userData": {
41
+
"sub": "...",
42
+
"preferred_username": "john@doe.org",
43
+
"name": "john@doe.org",
44
+
"email": "john@doe.org",
45
+
"email_verified": false,
46
+
"given_name": "john@doe.org",
47
+
"role": "user",
48
+
"amr": "pwd"
49
+
},
50
+
"allUserData": [
51
+
{
52
+
"configId": "configId",
53
+
"userData": {
54
+
"sub": "...",
55
+
"preferred_username": "john@doe.org",
56
+
"name": "john@doe.org",
57
+
"email": "john@doe.org",
58
+
"email_verified": false,
59
+
"given_name": "john@doe.org",
60
+
"role": "user",
61
+
"amr": "pwd"
62
+
}
63
+
}
64
+
]
33
65
}
34
66
```
35
67
36
68
Multiple Configs:
37
69
38
70
```json
39
-
[
40
-
{
41
-
"configId": "...",
42
-
"userData": {
43
-
"sub": "...",
44
-
"preferred_username": "john@doe.org",
45
-
"name": "john@doe.org",
46
-
"email": "john@doe.org",
47
-
"email_verified": false,
48
-
"given_name": "john@doe.org",
49
-
"role": "user",
50
-
"amr": "pwd"
71
+
{
72
+
"userData": null,
73
+
"allUserData": [
74
+
{
75
+
"configId": "configId1",
76
+
"userData": {
77
+
"sub": "...",
78
+
"preferred_username": "john@doe.org",
79
+
"name": "john@doe.org",
80
+
"email": "john@doe.org",
81
+
"email_verified": false,
82
+
"given_name": "john@doe.org",
83
+
"role": "user",
84
+
"amr": "pwd"
85
+
}
86
+
},
87
+
{
88
+
"configId": "configId2",
89
+
"userData": {
90
+
"sub": "...",
91
+
"preferred_username": "john@doe.org",
92
+
"name": "john@doe.org",
93
+
"email": "john@doe.org",
94
+
"email_verified": false,
95
+
"given_name": "john@doe.org",
96
+
"role": "user",
97
+
"amr": "pwd"
98
+
}
51
99
}
52
-
},
53
-
{
54
-
"configId": "...",
55
-
"userData": { ... }
56
-
}
57
-
]
100
+
]
101
+
}
58
102
```
59
103
60
104
## isAuthenticated$
61
105
62
-
This property returns an `Observable<boolean>` to receive authenticated events, either true or false if you run in a single config. If you run with multiple configs it returns an `ConfigAuthenticatedResult[]` holding the `configId`as well as a boolean to tell you if you are authenticated or not.
106
+
This property returns an `Observable<AuthenticatedResult>`. This object is filled depending on with how many configurations you run. The `AuthenticatedResult` is built as following:
In case you have a single config the `isAuthenticated` on the `AuthenticatedResult` tells you if you are authenticated or not. The `ConfigAuthenticatedResult[]` contains the single config result with it's `configId` and again if this config is authenticated or not.
122
+
123
+
In case you have multiple configs the `isAuthenticated` on the `AuthenticatedResult` tells you if all configs are authenticated (`true`) or not (`false`). The `ConfigAuthenticatedResult[]` contains the single config results with it's `configId` and again if this config is authenticated or not.
## `AutoLoginGuard` --> `AutoLoginAllRoutesGuard` and `AutoLoginPartialRoutesGuard`
518
532
519
533
Due to a lot of feedback about the `AutoLoginGuard` and usage we did not expect in that way we decided to give the `AuthGuard` a brush and divided it into a `AutoLoginAllRoutesGuard` when you want to secure your complete app and an `AutoLoginPartialRoutesGuard` if some of your routes are publicly accessible.
0 commit comments