@rxap/authentication 22.0.0-dev.0 → 22.0.0-dev.2
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/CHANGELOG.md +31 -0
- package/README.md +5 -3
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +75 -5
- package/compodoc/dependencies.html +96 -21
- package/compodoc/directives/SignOutDirective.html +140 -98
- package/compodoc/index.html +50 -8
- package/compodoc/injectables/AuthenticationRoutingService.html +69 -9
- package/compodoc/injectables/DisabledAuthenticationService.html +87 -21
- package/compodoc/injectables/RegisterService.html +77 -17
- package/compodoc/injectables/RxapAuthenticationGuard.html +105 -27
- package/compodoc/injectables/RxapAuthenticationService.html +98 -21
- package/compodoc/interfaces/AuthenticationAccessToken.html +172 -98
- package/compodoc/interfaces/AuthenticationEvent.html +131 -62
- package/compodoc/interfaces/IAuthenticationService.html +171 -115
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +25 -12
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +138 -0
- package/compodoc/miscellaneous/enumerations.html +45 -4
- package/compodoc/miscellaneous/functions.html +150 -20
- package/compodoc/miscellaneous/variables.html +72 -7
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +357 -210
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/AuthenticationRoutingService.html +58 -2
- package/docs/html/classes/DisabledAuthenticationService.html +112 -6
- package/docs/html/classes/RegisterService.html +81 -3
- package/docs/html/classes/RxapAuthenticationGuard.html +120 -7
- package/docs/html/classes/RxapAuthenticationService.html +114 -6
- package/docs/html/classes/SignOutDirective.html +94 -5
- package/docs/html/enums/AuthenticationEventType.html +66 -4
- package/docs/html/functions/BearerTokenInterceptor.html +43 -1
- package/docs/html/functions/provideAuthentication.html +43 -1
- package/docs/html/functions/withDisabledAuthentication.html +42 -1
- package/docs/html/functions/withInitialAuthenticationState.html +42 -1
- package/docs/html/hierarchy.html +34 -1
- package/docs/html/index.html +44 -7
- package/docs/html/interfaces/AuthenticationAccessToken.html +72 -3
- package/docs/html/interfaces/AuthenticationEvent.html +66 -2
- package/docs/html/interfaces/IAuthenticationService.html +94 -5
- package/docs/html/modules.html +52 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.html +33 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_DEACTIVATED.html +33 -1
- package/docs/html/variables/RXAP_INITIAL_AUTHENTICATION_STATE.html +33 -1
- package/docs/markdown/README.md +6 -4
- package/docs/markdown/classes/AuthenticationRoutingService.md +6 -6
- package/docs/markdown/classes/DisabledAuthenticationService.md +12 -12
- package/docs/markdown/classes/RegisterService.md +7 -7
- package/docs/markdown/classes/RxapAuthenticationGuard.md +11 -11
- package/docs/markdown/classes/RxapAuthenticationService.md +14 -14
- package/docs/markdown/classes/SignOutDirective.md +8 -8
- package/docs/markdown/enumerations/AuthenticationEventType.md +5 -5
- package/docs/markdown/functions/BearerTokenInterceptor.md +2 -2
- package/docs/markdown/functions/provideAuthentication.md +2 -2
- package/docs/markdown/functions/withDisabledAuthentication.md +4 -4
- package/docs/markdown/functions/withInitialAuthenticationState.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/AuthenticationAccessToken.md +6 -6
- package/docs/markdown/interfaces/AuthenticationEvent.md +4 -4
- package/docs/markdown/interfaces/IAuthenticationService.md +7 -7
- package/docs/markdown/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.md +3 -3
- package/docs/markdown/variables/RXAP_AUTHENTICATION_DEACTIVATED.md +2 -2
- package/docs/markdown/variables/RXAP_INITIAL_AUTHENTICATION_STATE.md +2 -2
- package/docs/wiki/Class.AuthenticationRoutingService.md +5 -5
- package/docs/wiki/Class.DisabledAuthenticationService.md +11 -11
- package/docs/wiki/Class.RegisterService.md +6 -6
- package/docs/wiki/Class.RxapAuthenticationGuard.md +10 -10
- package/docs/wiki/Class.RxapAuthenticationService.md +13 -13
- package/docs/wiki/Class.SignOutDirective.md +7 -7
- package/docs/wiki/Enumeration.AuthenticationEventType.md +4 -4
- package/docs/wiki/Function.BearerTokenInterceptor.md +1 -1
- package/docs/wiki/Function.provideAuthentication.md +1 -1
- package/docs/wiki/Function.withDisabledAuthentication.md +3 -3
- package/docs/wiki/Function.withInitialAuthenticationState.md +1 -1
- package/docs/wiki/Home.md +5 -3
- package/docs/wiki/Interface.AuthenticationAccessToken.md +5 -5
- package/docs/wiki/Interface.AuthenticationEvent.md +3 -3
- package/docs/wiki/Interface.IAuthenticationService.md +6 -6
- package/docs/wiki/Variable.RXAP_AUTHENTICATION_ACCESS_TOKEN.md +2 -2
- package/docs/wiki/Variable.RXAP_AUTHENTICATION_DEACTIVATED.md +1 -1
- package/docs/wiki/Variable.RXAP_INITIAL_AUTHENTICATION_STATE.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-authentication.mjs +363 -346
- package/fesm2022/rxap-authentication.mjs.map +1 -1
- package/generators.json +16 -0
- package/package.json +11 -13
- package/src/generators/init/generator.js +120 -0
- package/src/generators/init/index.js +6 -0
- package/src/generators/init/schema.json +8 -0
- package/src/generators/package.json +3 -0
- package/compodoc/js/libs/vis.min.js +0 -47
- package/compodoc/js/menu-wc_es5.js +0 -40
- package/theme.css +0 -1
|
@@ -3,388 +3,405 @@ import { Directive, Injectable, InjectionToken, inject, output } from "@angular/
|
|
|
3
3
|
import { Router } from "@angular/router";
|
|
4
4
|
import { BehaviorSubject, EMPTY, ReplaySubject, of, switchMap, take } from "rxjs";
|
|
5
5
|
import { tap } from "rxjs/operators";
|
|
6
|
+
import { __decorate } from "tslib";
|
|
6
7
|
const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken("rxap/authentication/deactivated");
|
|
7
8
|
const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken("rxap/authentication/access-token", {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
providedIn: "root",
|
|
10
|
+
factory: () => new BehaviorSubject(null)
|
|
10
11
|
});
|
|
11
12
|
const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken("rxap/authentication/initial-state", {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
providedIn: "root",
|
|
14
|
+
factory: () => false
|
|
14
15
|
});
|
|
15
16
|
function withDisabledAuthentication(disabled = true) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return {
|
|
18
|
+
provide: RXAP_AUTHENTICATION_DEACTIVATED,
|
|
19
|
+
useValue: disabled
|
|
20
|
+
};
|
|
20
21
|
}
|
|
21
22
|
var AuthenticationEventType;
|
|
22
|
-
(function(AuthenticationEventType) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
(function (AuthenticationEventType) {
|
|
24
|
+
AuthenticationEventType["OnAuthSuccess"] = "on-auth-success";
|
|
25
|
+
AuthenticationEventType["OnAuthError"] = "on-auth-error";
|
|
26
|
+
AuthenticationEventType["OnLogout"] = "on-logout";
|
|
26
27
|
})(AuthenticationEventType || (AuthenticationEventType = {}));
|
|
27
28
|
var RxapAuthenticationService = class RxapAuthenticationService {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
29
|
+
constructor() {
|
|
30
|
+
this.isAuthenticated$ = new BehaviorSubject(null);
|
|
31
|
+
this.events$ = new ReplaySubject();
|
|
32
|
+
this._authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);
|
|
33
|
+
this.isAuthenticated().then((isAuthenticated) => this.isAuthenticated$.next(isAuthenticated));
|
|
34
|
+
}
|
|
35
|
+
async signOut() {
|
|
36
|
+
this._authenticated = false;
|
|
37
|
+
this.isAuthenticated$.next(this._authenticated);
|
|
38
|
+
this.events$.next({ type: AuthenticationEventType.OnLogout });
|
|
39
|
+
}
|
|
40
|
+
isAuthenticated() {
|
|
41
|
+
return Promise.resolve(this._authenticated);
|
|
42
|
+
}
|
|
43
|
+
static {
|
|
44
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
45
|
+
minVersion: "12.0.0",
|
|
46
|
+
version: "22.3.0",
|
|
47
|
+
ngImport: i0,
|
|
48
|
+
type: RxapAuthenticationService,
|
|
49
|
+
deps: [],
|
|
50
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static {
|
|
54
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
55
|
+
minVersion: "12.0.0",
|
|
56
|
+
version: "22.3.0",
|
|
57
|
+
ngImport: i0,
|
|
58
|
+
type: RxapAuthenticationService,
|
|
59
|
+
providedIn: "root"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
61
62
|
};
|
|
62
63
|
i0.ɵɵngDeclareClassMetadata({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
minVersion: "12.0.0",
|
|
65
|
+
version: "22.3.0",
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
type: RxapAuthenticationService,
|
|
68
|
+
decorators: [{
|
|
69
|
+
type: Injectable,
|
|
70
|
+
args: [{ providedIn: "root" }]
|
|
71
|
+
}],
|
|
72
|
+
ctorParameters: () => []
|
|
72
73
|
});
|
|
73
74
|
var AuthenticationRoutingService = class AuthenticationRoutingService {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
75
|
+
constructor() {
|
|
76
|
+
this.router = inject(Router);
|
|
77
|
+
this.authenticationService = inject(RxapAuthenticationService);
|
|
78
|
+
this.deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;
|
|
79
|
+
if (!this.deactivated) {
|
|
80
|
+
console.log("Authentication is enabled");
|
|
81
|
+
this.authenticationService.isAuthenticated$.pipe(tap((isAuthenticated) => {
|
|
82
|
+
if (isAuthenticated)
|
|
83
|
+
return this.router.navigate(["/"]);
|
|
84
|
+
else
|
|
85
|
+
return this.router.navigate([
|
|
86
|
+
"/",
|
|
87
|
+
"authentication",
|
|
88
|
+
"login"
|
|
89
|
+
]);
|
|
90
|
+
})).subscribe();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
static {
|
|
94
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
95
|
+
minVersion: "12.0.0",
|
|
96
|
+
version: "22.3.0",
|
|
97
|
+
ngImport: i0,
|
|
98
|
+
type: AuthenticationRoutingService,
|
|
99
|
+
deps: [],
|
|
100
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
static {
|
|
104
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
105
|
+
minVersion: "12.0.0",
|
|
106
|
+
version: "22.3.0",
|
|
107
|
+
ngImport: i0,
|
|
108
|
+
type: AuthenticationRoutingService,
|
|
109
|
+
providedIn: "root"
|
|
110
|
+
});
|
|
111
|
+
}
|
|
109
112
|
};
|
|
110
113
|
i0.ɵɵngDeclareClassMetadata({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
minVersion: "12.0.0",
|
|
115
|
+
version: "22.3.0",
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
type: AuthenticationRoutingService,
|
|
118
|
+
decorators: [{
|
|
119
|
+
type: Injectable,
|
|
120
|
+
args: [{ providedIn: "root" }]
|
|
121
|
+
}],
|
|
122
|
+
ctorParameters: () => []
|
|
120
123
|
});
|
|
121
124
|
var RxapAuthenticationGuard = class RxapAuthenticationGuard {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
125
|
+
constructor() {
|
|
126
|
+
this.authentication = inject(RxapAuthenticationService);
|
|
127
|
+
this.router = inject(Router);
|
|
128
|
+
this.deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;
|
|
129
|
+
this.lastUrl = null;
|
|
130
|
+
}
|
|
131
|
+
canActivate(route, state) {
|
|
132
|
+
console.debug("[RxapAuthenticationGuard] can activate", state.url);
|
|
133
|
+
return this.checkAuthStatus(route, state);
|
|
134
|
+
}
|
|
135
|
+
canActivateChild(childRoute, state) {
|
|
136
|
+
console.debug("[RxapAuthenticationGuard] can activate child", state.url);
|
|
137
|
+
return this.checkAuthStatus(childRoute, state);
|
|
138
|
+
}
|
|
139
|
+
async checkAuthStatus(route, state) {
|
|
140
|
+
if (this.deactivated)
|
|
141
|
+
return true;
|
|
142
|
+
const authenticated = await this.authentication.isAuthenticated();
|
|
143
|
+
if (authenticated === null) {
|
|
144
|
+
if (!this.lastUrl || state.url !== "/" && !state.url.match(/authentication\/login/))
|
|
145
|
+
this.lastUrl = state.url;
|
|
146
|
+
return this.router.createUrlTree([
|
|
147
|
+
"/",
|
|
148
|
+
"authentication",
|
|
149
|
+
"loading"
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
if (authenticated) {
|
|
153
|
+
if (this.lastUrl && (state.url === "/" || state.url.match(/authentication\/login/))) {
|
|
154
|
+
const lastUrl = this.lastUrl;
|
|
155
|
+
this.lastUrl = null;
|
|
156
|
+
return this.createUrlTreeToLastUrl(lastUrl);
|
|
157
|
+
}
|
|
158
|
+
else if (state.url.match(/authentication/)) {
|
|
159
|
+
if (state.url.match(/authentication\/reset-password/))
|
|
160
|
+
return true;
|
|
161
|
+
return this.router.createUrlTree(["/"]);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.lastUrl = null;
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
if (!state.url.match(/^\/?authentication/))
|
|
170
|
+
this.lastUrl = state.url;
|
|
171
|
+
if (state.url.match(/^\/?authentication/)) {
|
|
172
|
+
if (this.lastUrl && this.lastUrl.match(/^\/?authentication/)) {
|
|
173
|
+
const lastUrl = this.lastUrl;
|
|
174
|
+
this.lastUrl = null;
|
|
175
|
+
return this.createUrlTreeToLastUrl(lastUrl);
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
return this.router.createUrlTree([
|
|
181
|
+
"/",
|
|
182
|
+
"authentication",
|
|
183
|
+
"login"
|
|
184
|
+
]);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
createUrlTreeToLastUrl(lastUrl) {
|
|
188
|
+
const urlMatch = lastUrl.match(/^([^?#]+)(\?([^#]+))?(#(.+))?$/);
|
|
189
|
+
if (urlMatch) {
|
|
190
|
+
let queryParams = {};
|
|
191
|
+
if (urlMatch[3])
|
|
192
|
+
queryParams = urlMatch[3].split("&").map((param) => {
|
|
193
|
+
const split = param.split("=");
|
|
194
|
+
return { [split[0]]: split[1] };
|
|
195
|
+
}).reduce((params, param) => ({
|
|
196
|
+
...params,
|
|
197
|
+
...param
|
|
198
|
+
}), {});
|
|
199
|
+
let fragment = void 0;
|
|
200
|
+
if (urlMatch[5])
|
|
201
|
+
fragment = urlMatch[5];
|
|
202
|
+
return this.router.createUrlTree([urlMatch[1]], {
|
|
203
|
+
queryParams,
|
|
204
|
+
fragment
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return this.router.createUrlTree([lastUrl]);
|
|
208
|
+
}
|
|
209
|
+
static {
|
|
210
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
211
|
+
minVersion: "12.0.0",
|
|
212
|
+
version: "22.3.0",
|
|
213
|
+
ngImport: i0,
|
|
214
|
+
type: RxapAuthenticationGuard,
|
|
215
|
+
deps: [],
|
|
216
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
static {
|
|
220
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
221
|
+
minVersion: "12.0.0",
|
|
222
|
+
version: "22.3.0",
|
|
223
|
+
ngImport: i0,
|
|
224
|
+
type: RxapAuthenticationGuard,
|
|
225
|
+
providedIn: "root"
|
|
226
|
+
});
|
|
227
|
+
}
|
|
214
228
|
};
|
|
215
229
|
i0.ɵɵngDeclareClassMetadata({
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "22.3.0",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: RxapAuthenticationGuard,
|
|
234
|
+
decorators: [{
|
|
235
|
+
type: Injectable,
|
|
236
|
+
args: [{ providedIn: "root" }]
|
|
237
|
+
}]
|
|
224
238
|
});
|
|
225
239
|
function BearerTokenInterceptor(req, next) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
240
|
+
const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);
|
|
241
|
+
if (req.url.match(/https?:\/\/[^/]+\/api/))
|
|
242
|
+
return accessToken$.pipe(take(1), switchMap((accessToken) => {
|
|
243
|
+
if (accessToken && (accessToken.valid === void 0 || accessToken.valid)) {
|
|
244
|
+
console.debug("Add access token to request", req.url);
|
|
245
|
+
return next(req.clone({ setHeaders: { Authorization: `Bearer ${accessToken.token}` } }));
|
|
246
|
+
}
|
|
247
|
+
else
|
|
248
|
+
console.debug("No valid access token found!", req.url);
|
|
249
|
+
return next(req);
|
|
250
|
+
}));
|
|
251
|
+
else
|
|
252
|
+
console.debug("Skip adding access token to request", req.url);
|
|
253
|
+
return next(req);
|
|
236
254
|
}
|
|
237
255
|
var DisabledAuthenticationService = class DisabledAuthenticationService {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
256
|
+
constructor() {
|
|
257
|
+
this.isAuthenticated$ = of(true);
|
|
258
|
+
this.events$ = EMPTY;
|
|
259
|
+
}
|
|
260
|
+
async signOut() {
|
|
261
|
+
console.log("Authentication is disabled. No sign out possible");
|
|
262
|
+
}
|
|
263
|
+
async isAuthenticated() {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
static {
|
|
267
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
268
|
+
minVersion: "12.0.0",
|
|
269
|
+
version: "22.3.0",
|
|
270
|
+
ngImport: i0,
|
|
271
|
+
type: DisabledAuthenticationService,
|
|
272
|
+
deps: [],
|
|
273
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
static {
|
|
277
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
278
|
+
minVersion: "12.0.0",
|
|
279
|
+
version: "22.3.0",
|
|
280
|
+
ngImport: i0,
|
|
281
|
+
type: DisabledAuthenticationService
|
|
282
|
+
});
|
|
283
|
+
}
|
|
266
284
|
};
|
|
267
285
|
i0.ɵɵngDeclareClassMetadata({
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "22.3.0",
|
|
288
|
+
ngImport: i0,
|
|
289
|
+
type: DisabledAuthenticationService,
|
|
290
|
+
decorators: [{ type: Injectable }]
|
|
273
291
|
});
|
|
274
292
|
function provideAuthentication(service, ...additionalProviders) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
293
|
+
return [{
|
|
294
|
+
provide: RxapAuthenticationService,
|
|
295
|
+
useClass: service
|
|
296
|
+
}, ...additionalProviders];
|
|
279
297
|
}
|
|
280
298
|
function withInitialAuthenticationState(state) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
299
|
+
return {
|
|
300
|
+
provide: RXAP_INITIAL_AUTHENTICATION_STATE,
|
|
301
|
+
useValue: state
|
|
302
|
+
};
|
|
285
303
|
}
|
|
286
304
|
var RegisterService = class RegisterService {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
constructor() {
|
|
306
|
+
console.warn("The default RegisterService implementation should only be used in a development environment!");
|
|
307
|
+
}
|
|
308
|
+
register(email, password) {
|
|
309
|
+
return Promise.resolve(true);
|
|
310
|
+
}
|
|
311
|
+
static {
|
|
312
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
313
|
+
minVersion: "12.0.0",
|
|
314
|
+
version: "22.3.0",
|
|
315
|
+
ngImport: i0,
|
|
316
|
+
type: RegisterService,
|
|
317
|
+
deps: [],
|
|
318
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
static {
|
|
322
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
323
|
+
minVersion: "12.0.0",
|
|
324
|
+
version: "22.3.0",
|
|
325
|
+
ngImport: i0,
|
|
326
|
+
type: RegisterService,
|
|
327
|
+
providedIn: "root"
|
|
328
|
+
});
|
|
329
|
+
}
|
|
312
330
|
};
|
|
313
331
|
i0.ɵɵngDeclareClassMetadata({
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
332
|
+
minVersion: "12.0.0",
|
|
333
|
+
version: "22.3.0",
|
|
334
|
+
ngImport: i0,
|
|
335
|
+
type: RegisterService,
|
|
336
|
+
decorators: [{
|
|
337
|
+
type: Injectable,
|
|
338
|
+
args: [{ providedIn: "root" }]
|
|
339
|
+
}],
|
|
340
|
+
ctorParameters: () => []
|
|
323
341
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
342
|
+
let SignOutDirective = class SignOutDirective {
|
|
343
|
+
constructor() {
|
|
344
|
+
this.auth = inject(RxapAuthenticationService);
|
|
345
|
+
this.successful = output();
|
|
346
|
+
this.failure = output();
|
|
347
|
+
}
|
|
348
|
+
async onClick() {
|
|
349
|
+
try {
|
|
350
|
+
await this.auth.signOut();
|
|
351
|
+
this.successful.emit();
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
this.failure.emit(e);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
static {
|
|
358
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
359
|
+
minVersion: "12.0.0",
|
|
360
|
+
version: "22.3.0",
|
|
361
|
+
ngImport: i0,
|
|
362
|
+
type: SignOutDirective,
|
|
363
|
+
deps: [],
|
|
364
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
static {
|
|
368
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
369
|
+
minVersion: "14.0.0",
|
|
370
|
+
version: "22.3.0",
|
|
371
|
+
type: SignOutDirective,
|
|
372
|
+
isStandalone: true,
|
|
373
|
+
selector: "[rxapSignOut]",
|
|
374
|
+
outputs: {
|
|
375
|
+
successful: "successful",
|
|
376
|
+
failure: "failure"
|
|
377
|
+
},
|
|
378
|
+
host: { listeners: { "click": "onClick()" } },
|
|
379
|
+
ngImport: i0
|
|
380
|
+
});
|
|
381
|
+
}
|
|
363
382
|
};
|
|
364
383
|
i0.ɵɵngDeclareClassMetadata({
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
minVersion: "12.0.0",
|
|
385
|
+
version: "22.3.0",
|
|
386
|
+
ngImport: i0,
|
|
387
|
+
type: SignOutDirective,
|
|
388
|
+
decorators: [{
|
|
389
|
+
type: Directive,
|
|
390
|
+
args: [{
|
|
391
|
+
selector: "[rxapSignOut]",
|
|
392
|
+
standalone: true,
|
|
393
|
+
host: { "(click)": "onClick()" }
|
|
394
|
+
}]
|
|
395
|
+
}],
|
|
396
|
+
propDecorators: {
|
|
397
|
+
successful: [{
|
|
398
|
+
type: i0.Output,
|
|
399
|
+
args: ["successful"]
|
|
400
|
+
}],
|
|
401
|
+
failure: [{
|
|
402
|
+
type: i0.Output,
|
|
403
|
+
args: ["failure"]
|
|
404
|
+
}]
|
|
405
|
+
}
|
|
387
406
|
});
|
|
388
407
|
export { AuthenticationEventType, AuthenticationRoutingService, BearerTokenInterceptor, DisabledAuthenticationService, RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED, RXAP_INITIAL_AUTHENTICATION_STATE, RegisterService, RxapAuthenticationGuard, RxapAuthenticationService, SignOutDirective, provideAuthentication, withDisabledAuthentication, withInitialAuthenticationState };
|
|
389
|
-
|
|
390
|
-
//# sourceMappingURL=rxap-authentication.mjs.map
|