@rxap/authentication 21.0.1 → 22.0.0-dev.1
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 +19 -0
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +62 -5
- package/compodoc/dependencies.html +96 -21
- package/compodoc/directives/SignOutDirective.html +140 -98
- package/compodoc/index.html +46 -5
- 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 +136 -0
- package/compodoc/miscellaneous/enumerations.html +45 -4
- package/compodoc/miscellaneous/functions.html +69 -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 +329 -206
- 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 +40 -4
- 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 +1 -1
- 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/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 +272 -148
- package/fesm2022/rxap-authentication.mjs.map +1 -1
- package/package.json +13 -13
- package/types/rxap-authentication.d.ts +79 -86
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: IAuthenticationService
|
|
4
4
|
|
|
5
|
-
Defined in: [authentication.service.ts:12](https://gitlab.com/rxap/packages/-/blob/
|
|
5
|
+
Defined in: [authentication.service.ts:12](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/authentication.service.ts#L12)
|
|
6
6
|
|
|
7
7
|
## Properties
|
|
8
8
|
|
|
@@ -10,15 +10,15 @@ Defined in: [authentication.service.ts:12](https://gitlab.com/rxap/packages/-/bl
|
|
|
10
10
|
|
|
11
11
|
> **events$**: `Observable`\<[`AuthenticationEvent`](../wiki/Interface.AuthenticationEvent)\>
|
|
12
12
|
|
|
13
|
-
Defined in: [authentication.service.ts:14](https://gitlab.com/rxap/packages/-/blob/
|
|
13
|
+
Defined in: [authentication.service.ts:14](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/authentication.service.ts#L14)
|
|
14
14
|
|
|
15
15
|
***
|
|
16
16
|
|
|
17
17
|
### isAuthenticated$
|
|
18
18
|
|
|
19
|
-
> **isAuthenticated$**: `Observable`\<`
|
|
19
|
+
> **isAuthenticated$**: `Observable`\<`boolean` \| `null`\>
|
|
20
20
|
|
|
21
|
-
Defined in: [authentication.service.ts:13](https://gitlab.com/rxap/packages/-/blob/
|
|
21
|
+
Defined in: [authentication.service.ts:13](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/authentication.service.ts#L13)
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ Defined in: [authentication.service.ts:13](https://gitlab.com/rxap/packages/-/bl
|
|
|
26
26
|
|
|
27
27
|
> **isAuthenticated**(): `Promise`\<`boolean`\>
|
|
28
28
|
|
|
29
|
-
Defined in: [authentication.service.ts:17](https://gitlab.com/rxap/packages/-/blob/
|
|
29
|
+
Defined in: [authentication.service.ts:17](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/authentication.service.ts#L17)
|
|
30
30
|
|
|
31
31
|
#### Returns
|
|
32
32
|
|
|
@@ -38,7 +38,7 @@ Defined in: [authentication.service.ts:17](https://gitlab.com/rxap/packages/-/bl
|
|
|
38
38
|
|
|
39
39
|
> **signOut**(): `Promise`\<`void`\>
|
|
40
40
|
|
|
41
|
-
Defined in: [authentication.service.ts:15](https://gitlab.com/rxap/packages/-/blob/
|
|
41
|
+
Defined in: [authentication.service.ts:15](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/authentication.service.ts#L15)
|
|
42
42
|
|
|
43
43
|
#### Returns
|
|
44
44
|
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# Variable: RXAP\_AUTHENTICATION\_ACCESS\_TOKEN
|
|
4
4
|
|
|
5
|
-
> `const` **RXAP\_AUTHENTICATION\_ACCESS\_TOKEN**: `InjectionToken`\<`BehaviorSubject
|
|
5
|
+
> `const` **RXAP\_AUTHENTICATION\_ACCESS\_TOKEN**: `InjectionToken`\<`BehaviorSubject`\<[`AuthenticationAccessToken`](../wiki/Interface.AuthenticationAccessToken) \| `null`\>\>
|
|
6
6
|
|
|
7
|
-
Defined in: [tokens.ts:14](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [tokens.ts:14](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/tokens.ts#L14)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **RXAP\_AUTHENTICATION\_DEACTIVATED**: `InjectionToken`\<`boolean`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [tokens.ts:7](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [tokens.ts:7](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/tokens.ts#L7)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **RXAP\_INITIAL\_AUTHENTICATION\_STATE**: `InjectionToken`\<`boolean`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [tokens.ts:22](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [tokens.ts:22](https://gitlab.com/rxap/packages/-/blob/947fa470d880611063dad4f2b0b1c759b5b07f1b/packages/angular/authentication/src/lib/tokens.ts#L22)
|
package/docs/wiki/globals.md
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { Router } from
|
|
4
|
-
import { BehaviorSubject, ReplaySubject,
|
|
5
|
-
import { tap } from
|
|
6
|
-
|
|
7
|
-
const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken(
|
|
8
|
-
const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken(
|
|
9
|
-
providedIn:
|
|
10
|
-
factory: () => new BehaviorSubject(null)
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, Injectable, InjectionToken, inject, output } from "@angular/core";
|
|
3
|
+
import { Router } from "@angular/router";
|
|
4
|
+
import { BehaviorSubject, EMPTY, ReplaySubject, of, switchMap, take } from "rxjs";
|
|
5
|
+
import { tap } from "rxjs/operators";
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken("rxap/authentication/deactivated");
|
|
8
|
+
const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken("rxap/authentication/access-token", {
|
|
9
|
+
providedIn: "root",
|
|
10
|
+
factory: () => new BehaviorSubject(null)
|
|
11
11
|
});
|
|
12
|
-
const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken(
|
|
13
|
-
providedIn:
|
|
14
|
-
factory: () => false
|
|
12
|
+
const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken("rxap/authentication/initial-state", {
|
|
13
|
+
providedIn: "root",
|
|
14
|
+
factory: () => false
|
|
15
15
|
});
|
|
16
16
|
function withDisabledAuthentication(disabled = true) {
|
|
17
17
|
return {
|
|
18
18
|
provide: RXAP_AUTHENTICATION_DEACTIVATED,
|
|
19
|
-
useValue: disabled
|
|
19
|
+
useValue: disabled
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
23
22
|
var AuthenticationEventType;
|
|
24
23
|
(function (AuthenticationEventType) {
|
|
25
24
|
AuthenticationEventType["OnAuthSuccess"] = "on-auth-success";
|
|
26
25
|
AuthenticationEventType["OnAuthError"] = "on-auth-error";
|
|
27
26
|
AuthenticationEventType["OnLogout"] = "on-logout";
|
|
28
27
|
})(AuthenticationEventType || (AuthenticationEventType = {}));
|
|
29
|
-
class RxapAuthenticationService {
|
|
28
|
+
var RxapAuthenticationService = class RxapAuthenticationService {
|
|
30
29
|
constructor() {
|
|
31
30
|
this.isAuthenticated$ = new BehaviorSubject(null);
|
|
32
31
|
this.events$ = new ReplaySubject();
|
|
33
32
|
this._authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);
|
|
34
|
-
this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));
|
|
33
|
+
this.isAuthenticated().then((isAuthenticated) => this.isAuthenticated$.next(isAuthenticated));
|
|
35
34
|
}
|
|
36
35
|
async signOut() {
|
|
37
36
|
this._authenticated = false;
|
|
@@ -41,43 +40,88 @@ class RxapAuthenticationService {
|
|
|
41
40
|
isAuthenticated() {
|
|
42
41
|
return Promise.resolve(this._authenticated);
|
|
43
42
|
}
|
|
44
|
-
static {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
}
|
|
62
|
+
};
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
64
|
+
minVersion: "12.0.0",
|
|
65
|
+
version: "22.3.0",
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
type: RxapAuthenticationService,
|
|
68
|
+
decorators: [{
|
|
48
69
|
type: Injectable,
|
|
49
|
-
args: [{ providedIn:
|
|
50
|
-
}],
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
args: [{ providedIn: "root" }]
|
|
71
|
+
}],
|
|
72
|
+
ctorParameters: () => []
|
|
73
|
+
});
|
|
74
|
+
var AuthenticationRoutingService = class AuthenticationRoutingService {
|
|
53
75
|
constructor() {
|
|
54
76
|
this.router = inject(Router);
|
|
55
77
|
this.authenticationService = inject(RxapAuthenticationService);
|
|
56
78
|
this.deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
+
]);
|
|
67
90
|
})).subscribe();
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
|
-
static {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
}
|
|
112
|
+
};
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
114
|
+
minVersion: "12.0.0",
|
|
115
|
+
version: "22.3.0",
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
type: AuthenticationRoutingService,
|
|
118
|
+
decorators: [{
|
|
74
119
|
type: Injectable,
|
|
75
|
-
args: [{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class RxapAuthenticationGuard {
|
|
120
|
+
args: [{ providedIn: "root" }]
|
|
121
|
+
}],
|
|
122
|
+
ctorParameters: () => []
|
|
123
|
+
});
|
|
124
|
+
var RxapAuthenticationGuard = class RxapAuthenticationGuard {
|
|
81
125
|
constructor() {
|
|
82
126
|
this.authentication = inject(RxapAuthenticationService);
|
|
83
127
|
this.router = inject(Router);
|
|
@@ -85,47 +129,45 @@ class RxapAuthenticationGuard {
|
|
|
85
129
|
this.lastUrl = null;
|
|
86
130
|
}
|
|
87
131
|
canActivate(route, state) {
|
|
88
|
-
console.debug(
|
|
132
|
+
console.debug("[RxapAuthenticationGuard] can activate", state.url);
|
|
89
133
|
return this.checkAuthStatus(route, state);
|
|
90
134
|
}
|
|
91
135
|
canActivateChild(childRoute, state) {
|
|
92
|
-
console.debug(
|
|
136
|
+
console.debug("[RxapAuthenticationGuard] can activate child", state.url);
|
|
93
137
|
return this.checkAuthStatus(childRoute, state);
|
|
94
138
|
}
|
|
95
139
|
async checkAuthStatus(route, state) {
|
|
96
|
-
if (this.deactivated)
|
|
140
|
+
if (this.deactivated)
|
|
97
141
|
return true;
|
|
98
|
-
}
|
|
99
142
|
const authenticated = await this.authentication.isAuthenticated();
|
|
100
143
|
if (authenticated === null) {
|
|
101
|
-
if (!this.lastUrl ||
|
|
144
|
+
if (!this.lastUrl || state.url !== "/" && !state.url.match(/authentication\/login/))
|
|
102
145
|
this.lastUrl = state.url;
|
|
103
|
-
|
|
104
|
-
|
|
146
|
+
return this.router.createUrlTree([
|
|
147
|
+
"/",
|
|
148
|
+
"authentication",
|
|
149
|
+
"loading"
|
|
150
|
+
]);
|
|
105
151
|
}
|
|
106
152
|
if (authenticated) {
|
|
107
|
-
if (this.lastUrl && (state.url
|
|
153
|
+
if (this.lastUrl && (state.url === "/" || state.url.match(/authentication\/login/))) {
|
|
108
154
|
const lastUrl = this.lastUrl;
|
|
109
155
|
this.lastUrl = null;
|
|
110
156
|
return this.createUrlTreeToLastUrl(lastUrl);
|
|
111
157
|
}
|
|
112
|
-
else {
|
|
113
|
-
if (state.url.match(/authentication/))
|
|
114
|
-
if (state.url.match(/authentication\/reset-password/)) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
return this.router.createUrlTree(['/']);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
this.lastUrl = null;
|
|
158
|
+
else if (state.url.match(/authentication/)) {
|
|
159
|
+
if (state.url.match(/authentication\/reset-password/))
|
|
121
160
|
return true;
|
|
122
|
-
|
|
161
|
+
return this.router.createUrlTree(["/"]);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.lastUrl = null;
|
|
165
|
+
return true;
|
|
123
166
|
}
|
|
124
167
|
}
|
|
125
168
|
else {
|
|
126
|
-
if (!state.url.match(/^\/?authentication/))
|
|
169
|
+
if (!state.url.match(/^\/?authentication/))
|
|
127
170
|
this.lastUrl = state.url;
|
|
128
|
-
}
|
|
129
171
|
if (state.url.match(/^\/?authentication/)) {
|
|
130
172
|
if (this.lastUrl && this.lastUrl.match(/^\/?authentication/)) {
|
|
131
173
|
const lastUrl = this.lastUrl;
|
|
@@ -134,116 +176,170 @@ class RxapAuthenticationGuard {
|
|
|
134
176
|
}
|
|
135
177
|
return true;
|
|
136
178
|
}
|
|
137
|
-
else
|
|
138
|
-
return this.router.createUrlTree([
|
|
139
|
-
|
|
179
|
+
else
|
|
180
|
+
return this.router.createUrlTree([
|
|
181
|
+
"/",
|
|
182
|
+
"authentication",
|
|
183
|
+
"login"
|
|
184
|
+
]);
|
|
140
185
|
}
|
|
141
186
|
}
|
|
142
187
|
createUrlTreeToLastUrl(lastUrl) {
|
|
143
188
|
const urlMatch = lastUrl.match(/^([^?#]+)(\?([^#]+))?(#(.+))?$/);
|
|
144
189
|
if (urlMatch) {
|
|
145
190
|
let queryParams = {};
|
|
146
|
-
if (urlMatch[3])
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const split = param.split('=');
|
|
191
|
+
if (urlMatch[3])
|
|
192
|
+
queryParams = urlMatch[3].split("&").map((param) => {
|
|
193
|
+
const split = param.split("=");
|
|
150
194
|
return { [split[0]]: split[1] };
|
|
151
|
-
}).reduce((params, param) => ({
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
195
|
+
}).reduce((params, param) => ({
|
|
196
|
+
...params,
|
|
197
|
+
...param
|
|
198
|
+
}), {});
|
|
199
|
+
let fragment = void 0;
|
|
200
|
+
if (urlMatch[5])
|
|
155
201
|
fragment = urlMatch[5];
|
|
156
|
-
}
|
|
157
202
|
return this.router.createUrlTree([urlMatch[1]], {
|
|
158
203
|
queryParams,
|
|
159
|
-
fragment
|
|
204
|
+
fragment
|
|
160
205
|
});
|
|
161
206
|
}
|
|
162
207
|
return this.router.createUrlTree([lastUrl]);
|
|
163
208
|
}
|
|
164
|
-
static {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
+
}
|
|
228
|
+
};
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "22.3.0",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: RxapAuthenticationGuard,
|
|
234
|
+
decorators: [{
|
|
168
235
|
type: Injectable,
|
|
169
|
-
args: [{ providedIn:
|
|
170
|
-
}]
|
|
171
|
-
|
|
236
|
+
args: [{ providedIn: "root" }]
|
|
237
|
+
}]
|
|
238
|
+
});
|
|
172
239
|
function BearerTokenInterceptor(req, next) {
|
|
173
240
|
const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);
|
|
174
|
-
if (req.url.match(/https?:\/\/[^/]+\/api/))
|
|
175
|
-
return accessToken$.pipe(take(1), switchMap(accessToken => {
|
|
176
|
-
if (accessToken && (accessToken.valid ===
|
|
177
|
-
console.debug(
|
|
178
|
-
return next(req.clone({
|
|
179
|
-
setHeaders: {
|
|
180
|
-
Authorization: `Bearer ${accessToken.token}`,
|
|
181
|
-
},
|
|
182
|
-
}));
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
console.debug('No valid access token found!', req.url);
|
|
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}` } }));
|
|
186
246
|
}
|
|
247
|
+
else
|
|
248
|
+
console.debug("No valid access token found!", req.url);
|
|
187
249
|
return next(req);
|
|
188
250
|
}));
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
console.debug('Skip adding access token to request', req.url);
|
|
192
|
-
}
|
|
251
|
+
else
|
|
252
|
+
console.debug("Skip adding access token to request", req.url);
|
|
193
253
|
return next(req);
|
|
194
254
|
}
|
|
195
|
-
|
|
196
|
-
class DisabledAuthenticationService {
|
|
255
|
+
var DisabledAuthenticationService = class DisabledAuthenticationService {
|
|
197
256
|
constructor() {
|
|
198
257
|
this.isAuthenticated$ = of(true);
|
|
199
258
|
this.events$ = EMPTY;
|
|
200
259
|
}
|
|
201
260
|
async signOut() {
|
|
202
|
-
console.log(
|
|
261
|
+
console.log("Authentication is disabled. No sign out possible");
|
|
203
262
|
}
|
|
204
263
|
async isAuthenticated() {
|
|
205
264
|
return true;
|
|
206
265
|
}
|
|
207
|
-
static {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
+
}
|
|
284
|
+
};
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "22.3.0",
|
|
288
|
+
ngImport: i0,
|
|
289
|
+
type: DisabledAuthenticationService,
|
|
290
|
+
decorators: [{ type: Injectable }]
|
|
291
|
+
});
|
|
214
292
|
function provideAuthentication(service, ...additionalProviders) {
|
|
215
|
-
return [
|
|
216
|
-
{
|
|
293
|
+
return [{
|
|
217
294
|
provide: RxapAuthenticationService,
|
|
218
|
-
useClass: service
|
|
219
|
-
},
|
|
220
|
-
...additionalProviders,
|
|
221
|
-
];
|
|
295
|
+
useClass: service
|
|
296
|
+
}, ...additionalProviders];
|
|
222
297
|
}
|
|
223
298
|
function withInitialAuthenticationState(state) {
|
|
224
299
|
return {
|
|
225
300
|
provide: RXAP_INITIAL_AUTHENTICATION_STATE,
|
|
226
|
-
useValue: state
|
|
301
|
+
useValue: state
|
|
227
302
|
};
|
|
228
303
|
}
|
|
229
|
-
|
|
230
|
-
/* ignore coverage */
|
|
231
|
-
class RegisterService {
|
|
304
|
+
var RegisterService = class RegisterService {
|
|
232
305
|
constructor() {
|
|
233
|
-
console.warn(
|
|
306
|
+
console.warn("The default RegisterService implementation should only be used in a development environment!");
|
|
234
307
|
}
|
|
235
308
|
register(email, password) {
|
|
236
309
|
return Promise.resolve(true);
|
|
237
310
|
}
|
|
238
|
-
static {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
+
}
|
|
330
|
+
};
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
332
|
+
minVersion: "12.0.0",
|
|
333
|
+
version: "22.3.0",
|
|
334
|
+
ngImport: i0,
|
|
335
|
+
type: RegisterService,
|
|
336
|
+
decorators: [{
|
|
242
337
|
type: Injectable,
|
|
243
|
-
args: [{ providedIn:
|
|
244
|
-
}],
|
|
245
|
-
|
|
246
|
-
|
|
338
|
+
args: [{ providedIn: "root" }]
|
|
339
|
+
}],
|
|
340
|
+
ctorParameters: () => []
|
|
341
|
+
});
|
|
342
|
+
let SignOutDirective = class SignOutDirective {
|
|
247
343
|
constructor() {
|
|
248
344
|
this.auth = inject(RxapAuthenticationService);
|
|
249
345
|
this.successful = output();
|
|
@@ -258,26 +354,54 @@ class SignOutDirective {
|
|
|
258
354
|
this.failure.emit(e);
|
|
259
355
|
}
|
|
260
356
|
}
|
|
261
|
-
static {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
+
}
|
|
382
|
+
};
|
|
383
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
384
|
+
minVersion: "12.0.0",
|
|
385
|
+
version: "22.3.0",
|
|
386
|
+
ngImport: i0,
|
|
387
|
+
type: SignOutDirective,
|
|
388
|
+
decorators: [{
|
|
265
389
|
type: Directive,
|
|
266
390
|
args: [{
|
|
267
|
-
selector:
|
|
391
|
+
selector: "[rxapSignOut]",
|
|
268
392
|
standalone: true,
|
|
269
|
-
host: {
|
|
270
|
-
'(click)': 'onClick()',
|
|
271
|
-
},
|
|
393
|
+
host: { "(click)": "onClick()" }
|
|
272
394
|
}]
|
|
273
|
-
}],
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
395
|
+
}],
|
|
396
|
+
propDecorators: {
|
|
397
|
+
successful: [{
|
|
398
|
+
type: i0.Output,
|
|
399
|
+
args: ["successful"]
|
|
400
|
+
}],
|
|
401
|
+
failure: [{
|
|
402
|
+
type: i0.Output,
|
|
403
|
+
args: ["failure"]
|
|
404
|
+
}]
|
|
405
|
+
}
|
|
406
|
+
});
|
|
282
407
|
export { AuthenticationEventType, AuthenticationRoutingService, BearerTokenInterceptor, DisabledAuthenticationService, RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED, RXAP_INITIAL_AUTHENTICATION_STATE, RegisterService, RxapAuthenticationGuard, RxapAuthenticationService, SignOutDirective, provideAuthentication, withDisabledAuthentication, withInitialAuthenticationState };
|
|
283
|
-
//# sourceMappingURL=rxap-authentication.mjs.map
|