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