@rxap/authentication 16.0.0-dev.2 → 16.0.0-dev.21
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 +380 -0
- package/LICENSE +621 -21
- package/LICENSE.md +621 -0
- package/README.md +8 -22
- package/esm2022/index.mjs +6 -4
- package/esm2022/lib/authentication-routing.service.mjs +7 -8
- package/esm2022/lib/authentication.guard.mjs +7 -8
- package/esm2022/lib/authentication.service.mjs +12 -61
- package/esm2022/lib/bearer-token.interceptor.mjs +27 -0
- package/esm2022/lib/register.service.mjs +6 -6
- package/esm2022/lib/sign-out.directive.mjs +7 -8
- package/esm2022/lib/tokens.mjs +17 -2
- package/esm2022/rxap-authentication.mjs +1 -1
- package/fesm2022/rxap-authentication.mjs +102 -121
- package/fesm2022/rxap-authentication.mjs.map +1 -1
- package/index.d.ts +3 -3
- package/lib/authentication.guard.d.ts +1 -1
- package/lib/authentication.service.d.ts +3 -10
- package/lib/bearer-token.interceptor.d.ts +3 -0
- package/lib/tokens.d.ts +9 -1
- package/package.json +52 -62
- package/theme.css +1 -0
- package/collection.json +0 -10
- package/components/README.md +0 -3
- package/components/index.d.ts +0 -5
- package/components/lib/authentication-container/authentication-container.component.d.ts +0 -7
- package/components/lib/fade-animation.d.ts +0 -1
- package/components/lib/loading/loading.component.d.ts +0 -15
- package/components/lib/login/login.component.d.ts +0 -13
- package/components/lib/login/login.form.d.ts +0 -43
- package/components/lib/reset-password/reset-password.component.d.ts +0 -5
- package/components/lib/reset-password/reset-password.form.d.ts +0 -35
- package/components/lib/routes.d.ts +0 -2
- package/components/public_api.d.ts +0 -8
- package/esm2022/components/lib/authentication-container/authentication-container.component.mjs +0 -39
- package/esm2022/components/lib/fade-animation.mjs +0 -14
- package/esm2022/components/lib/loading/loading.component.mjs +0 -40
- package/esm2022/components/lib/login/login.component.mjs +0 -113
- package/esm2022/components/lib/login/login.form.mjs +0 -117
- package/esm2022/components/lib/reset-password/reset-password.component.mjs +0 -61
- package/esm2022/components/lib/reset-password/reset-password.form.mjs +0 -116
- package/esm2022/components/lib/routes.mjs +0 -32
- package/esm2022/components/public_api.mjs +0 -9
- package/esm2022/components/rxap-authentication-components.mjs +0 -5
- package/esm2022/lib/user.service.mjs +0 -16
- package/fesm2022/rxap-authentication-components.mjs +0 -472
- package/fesm2022/rxap-authentication-components.mjs.map +0 -1
- package/lib/user.service.d.ts +0 -16
- package/migration.json +0 -4
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
2
|
+
import { InjectionToken, inject, Injectable, Inject, Optional, EventEmitter, Directive, Output, HostListener } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/router';
|
|
4
4
|
import { Router } from '@angular/router';
|
|
5
|
-
import { BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
5
|
+
import { BehaviorSubject, ReplaySubject, take, switchMap } from 'rxjs';
|
|
6
6
|
import { tap } from 'rxjs/operators';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
8
|
+
const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken('rxap/authentication/deactivated');
|
|
9
|
+
const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken('rxap/authentication/access-token', {
|
|
10
|
+
providedIn: 'root',
|
|
11
|
+
factory: () => new BehaviorSubject(null),
|
|
12
|
+
});
|
|
13
|
+
const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken('rxap/authentication/initial-state', {
|
|
14
|
+
providedIn: 'root',
|
|
15
|
+
factory: () => false,
|
|
16
|
+
});
|
|
17
|
+
function withDisabledAuthentication(disabled = true) {
|
|
18
|
+
return {
|
|
19
|
+
provide: RXAP_AUTHENTICATION_DEACTIVATED,
|
|
20
|
+
useValue: disabled,
|
|
21
|
+
};
|
|
22
22
|
}
|
|
23
|
+
|
|
23
24
|
var AuthenticationEventType;
|
|
24
25
|
(function (AuthenticationEventType) {
|
|
25
26
|
AuthenticationEventType["OnAuthSuccess"] = "on-auth-success";
|
|
@@ -30,60 +31,62 @@ class RxapAuthenticationService {
|
|
|
30
31
|
constructor() {
|
|
31
32
|
this.isAuthenticated$ = new BehaviorSubject(null);
|
|
32
33
|
this.events$ = new ReplaySubject();
|
|
33
|
-
|
|
34
|
+
this._authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);
|
|
34
35
|
this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));
|
|
35
36
|
}
|
|
36
|
-
requestPasswordReset(email) {
|
|
37
|
-
console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');
|
|
38
|
-
return TimeoutResolve(email !== 'fail@fail', 2500);
|
|
39
|
-
}
|
|
40
|
-
sendPasswordReset(password, token) {
|
|
41
|
-
console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');
|
|
42
|
-
return TimeoutResolve(password !== 'fail', 2500);
|
|
43
|
-
}
|
|
44
|
-
async signInWithEmailAndPassword(email, password, remember) {
|
|
45
|
-
console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');
|
|
46
|
-
return TimeoutPromise((resolve, reject) => {
|
|
47
|
-
const login = password !== 'fail';
|
|
48
|
-
this.isAuthenticated$.next(login);
|
|
49
|
-
if (login) {
|
|
50
|
-
if (remember) {
|
|
51
|
-
localStorage.setItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY, 'true');
|
|
52
|
-
}
|
|
53
|
-
resolve(login);
|
|
54
|
-
this.events$.next({ type: AuthenticationEventType.OnAuthSuccess });
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
localStorage.removeItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY);
|
|
58
|
-
reject(new Error('Login credentials are invalid'));
|
|
59
|
-
this.events$.next({ type: AuthenticationEventType.OnAuthError });
|
|
60
|
-
}
|
|
61
|
-
}, 2500);
|
|
62
|
-
}
|
|
63
37
|
async signOut() {
|
|
64
|
-
|
|
65
|
-
this.isAuthenticated$.next(
|
|
66
|
-
localStorage.removeItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY);
|
|
38
|
+
this._authenticated = false;
|
|
39
|
+
this.isAuthenticated$.next(this._authenticated);
|
|
67
40
|
this.events$.next({ type: AuthenticationEventType.OnLogout });
|
|
68
41
|
}
|
|
69
|
-
signInWithProvider(provider) {
|
|
70
|
-
console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');
|
|
71
|
-
return Promise.resolve(false);
|
|
72
|
-
}
|
|
73
42
|
isAuthenticated() {
|
|
74
|
-
return
|
|
75
|
-
resolve(localStorage.getItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY) === 'true');
|
|
76
|
-
}, 2500);
|
|
43
|
+
return Promise.resolve(this._authenticated);
|
|
77
44
|
}
|
|
78
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
79
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
46
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationService, providedIn: 'root' }); }
|
|
80
47
|
}
|
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationService, decorators: [{
|
|
82
49
|
type: Injectable,
|
|
83
50
|
args: [{ providedIn: 'root' }]
|
|
84
51
|
}], ctorParameters: function () { return []; } });
|
|
85
52
|
|
|
86
|
-
|
|
53
|
+
class AuthenticationRoutingService {
|
|
54
|
+
constructor(router, authenticationService, deactivated = null) {
|
|
55
|
+
this.router = router;
|
|
56
|
+
this.authenticationService = authenticationService;
|
|
57
|
+
this.deactivated = deactivated;
|
|
58
|
+
if (!deactivated) {
|
|
59
|
+
console.log('Authentication is enabled');
|
|
60
|
+
this.authenticationService.isAuthenticated$.pipe(tap(isAuthenticated => {
|
|
61
|
+
if (isAuthenticated) {
|
|
62
|
+
return this.router.navigate(['/']);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return this.router.navigate(['/', 'authentication', 'login']);
|
|
66
|
+
}
|
|
67
|
+
})).subscribe();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AuthenticationRoutingService, deps: [{ token: Router }, { token: RxapAuthenticationService }, { token: RXAP_AUTHENTICATION_DEACTIVATED, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
71
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AuthenticationRoutingService, providedIn: 'root' }); }
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AuthenticationRoutingService, decorators: [{
|
|
74
|
+
type: Injectable,
|
|
75
|
+
args: [{
|
|
76
|
+
providedIn: 'root',
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: function () { return [{ type: i1.Router, decorators: [{
|
|
79
|
+
type: Inject,
|
|
80
|
+
args: [Router]
|
|
81
|
+
}] }, { type: RxapAuthenticationService, decorators: [{
|
|
82
|
+
type: Inject,
|
|
83
|
+
args: [RxapAuthenticationService]
|
|
84
|
+
}] }, { type: undefined, decorators: [{
|
|
85
|
+
type: Optional
|
|
86
|
+
}, {
|
|
87
|
+
type: Inject,
|
|
88
|
+
args: [RXAP_AUTHENTICATION_DEACTIVATED]
|
|
89
|
+
}] }]; } });
|
|
87
90
|
|
|
88
91
|
class RxapAuthenticationGuard {
|
|
89
92
|
constructor(authentication, router, deactivated = null) {
|
|
@@ -169,16 +172,16 @@ class RxapAuthenticationGuard {
|
|
|
169
172
|
}
|
|
170
173
|
return this.router.createUrlTree([lastUrl]);
|
|
171
174
|
}
|
|
172
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
173
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationGuard, deps: [{ token: RxapAuthenticationService }, { token: Router }, { token: RXAP_AUTHENTICATION_DEACTIVATED, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
176
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationGuard, providedIn: 'root' }); }
|
|
174
177
|
}
|
|
175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapAuthenticationGuard, decorators: [{
|
|
176
179
|
type: Injectable,
|
|
177
180
|
args: [{ providedIn: 'root' }]
|
|
178
181
|
}], ctorParameters: function () { return [{ type: RxapAuthenticationService, decorators: [{
|
|
179
182
|
type: Inject,
|
|
180
183
|
args: [RxapAuthenticationService]
|
|
181
|
-
}] }, { type:
|
|
184
|
+
}] }, { type: i1.Router, decorators: [{
|
|
182
185
|
type: Inject,
|
|
183
186
|
args: [Router]
|
|
184
187
|
}] }, { type: undefined, decorators: [{
|
|
@@ -188,6 +191,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
188
191
|
args: [RXAP_AUTHENTICATION_DEACTIVATED]
|
|
189
192
|
}] }]; } });
|
|
190
193
|
|
|
194
|
+
function BearerTokenInterceptor(req, next) {
|
|
195
|
+
const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);
|
|
196
|
+
if (req.url.match(/https?:\/\/[^/]+\/api/)) {
|
|
197
|
+
return accessToken$.pipe(take(1), switchMap(accessToken => {
|
|
198
|
+
if (accessToken && (accessToken.valid === undefined || accessToken.valid)) {
|
|
199
|
+
console.debug('Add access token to request', req.url);
|
|
200
|
+
return next(req.clone({
|
|
201
|
+
setHeaders: {
|
|
202
|
+
Authorization: `Bearer ${accessToken.token}`,
|
|
203
|
+
},
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
console.debug('No valid access token found!', req.url);
|
|
208
|
+
}
|
|
209
|
+
return next(req);
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
console.debug('Skip adding access token to request', req.url);
|
|
214
|
+
}
|
|
215
|
+
return next(req);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* ignore coverage */
|
|
191
219
|
class RegisterService {
|
|
192
220
|
constructor() {
|
|
193
221
|
console.warn('The default RegisterService implementation should only be used in a development environment!');
|
|
@@ -195,64 +223,14 @@ class RegisterService {
|
|
|
195
223
|
register(email, password) {
|
|
196
224
|
return Promise.resolve(true);
|
|
197
225
|
}
|
|
198
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
199
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
226
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RegisterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
227
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RegisterService, providedIn: 'root' }); }
|
|
200
228
|
}
|
|
201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RegisterService, decorators: [{
|
|
202
230
|
type: Injectable,
|
|
203
231
|
args: [{ providedIn: 'root' }]
|
|
204
232
|
}], ctorParameters: function () { return []; } });
|
|
205
233
|
|
|
206
|
-
class UserService {
|
|
207
|
-
constructor() {
|
|
208
|
-
this.user$ = new BehaviorSubject(null);
|
|
209
|
-
}
|
|
210
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
211
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: UserService, providedIn: 'root' }); }
|
|
212
|
-
}
|
|
213
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: UserService, decorators: [{
|
|
214
|
-
type: Injectable,
|
|
215
|
-
args: [{ providedIn: 'root' }]
|
|
216
|
-
}] });
|
|
217
|
-
|
|
218
|
-
class AuthenticationRoutingService {
|
|
219
|
-
constructor(router, authenticationService, deactivated = null) {
|
|
220
|
-
this.router = router;
|
|
221
|
-
this.authenticationService = authenticationService;
|
|
222
|
-
this.deactivated = deactivated;
|
|
223
|
-
if (!deactivated) {
|
|
224
|
-
console.log('Authentication is enabled');
|
|
225
|
-
this.authenticationService.isAuthenticated$.pipe(tap(isAuthenticated => {
|
|
226
|
-
if (isAuthenticated) {
|
|
227
|
-
return this.router.navigate(['/']);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
return this.router.navigate(['/', 'authentication', 'login']);
|
|
231
|
-
}
|
|
232
|
-
})).subscribe();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AuthenticationRoutingService, deps: [{ token: Router }, { token: RxapAuthenticationService }, { token: RXAP_AUTHENTICATION_DEACTIVATED, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
236
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AuthenticationRoutingService, providedIn: 'root' }); }
|
|
237
|
-
}
|
|
238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AuthenticationRoutingService, decorators: [{
|
|
239
|
-
type: Injectable,
|
|
240
|
-
args: [{
|
|
241
|
-
providedIn: 'root'
|
|
242
|
-
}]
|
|
243
|
-
}], ctorParameters: function () { return [{ type: i2.Router, decorators: [{
|
|
244
|
-
type: Inject,
|
|
245
|
-
args: [Router]
|
|
246
|
-
}] }, { type: RxapAuthenticationService, decorators: [{
|
|
247
|
-
type: Inject,
|
|
248
|
-
args: [RxapAuthenticationService]
|
|
249
|
-
}] }, { type: undefined, decorators: [{
|
|
250
|
-
type: Optional
|
|
251
|
-
}, {
|
|
252
|
-
type: Inject,
|
|
253
|
-
args: [RXAP_AUTHENTICATION_DEACTIVATED]
|
|
254
|
-
}] }]; } });
|
|
255
|
-
|
|
256
234
|
class SignOutDirective {
|
|
257
235
|
constructor(auth) {
|
|
258
236
|
this.auth = auth;
|
|
@@ -268,14 +246,14 @@ class SignOutDirective {
|
|
|
268
246
|
this.failure.emit(e);
|
|
269
247
|
}
|
|
270
248
|
}
|
|
271
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
272
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SignOutDirective, deps: [{ token: RxapAuthenticationService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
250
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: SignOutDirective, isStandalone: true, selector: "[rxapSignOut]", outputs: { successful: "successful", failure: "failure" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
273
251
|
}
|
|
274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
275
253
|
type: Directive,
|
|
276
254
|
args: [{
|
|
277
255
|
selector: '[rxapSignOut]',
|
|
278
|
-
standalone: true
|
|
256
|
+
standalone: true,
|
|
279
257
|
}]
|
|
280
258
|
}], ctorParameters: function () { return [{ type: RxapAuthenticationService }]; }, propDecorators: { successful: [{
|
|
281
259
|
type: Output
|
|
@@ -286,9 +264,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
286
264
|
args: ['click']
|
|
287
265
|
}] } });
|
|
288
266
|
|
|
267
|
+
// region
|
|
268
|
+
// endregion
|
|
269
|
+
|
|
289
270
|
/**
|
|
290
271
|
* Generated bundle index. Do not edit.
|
|
291
272
|
*/
|
|
292
273
|
|
|
293
|
-
export { AuthenticationEventType, AuthenticationRoutingService, RXAP_AUTHENTICATION_DEACTIVATED,
|
|
274
|
+
export { AuthenticationEventType, AuthenticationRoutingService, BearerTokenInterceptor, RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED, RXAP_INITIAL_AUTHENTICATION_STATE, RegisterService, RxapAuthenticationGuard, RxapAuthenticationService, SignOutDirective, withDisabledAuthentication };
|
|
294
275
|
//# sourceMappingURL=rxap-authentication.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-authentication.mjs","sources":["../../../../libs/authentication/src/lib/authentication.service.ts","../../../../libs/authentication/src/lib/tokens.ts","../../../../libs/authentication/src/lib/authentication.guard.ts","../../../../libs/authentication/src/lib/register.service.ts","../../../../libs/authentication/src/lib/user.service.ts","../../../../libs/authentication/src/lib/authentication-routing.service.ts","../../../../libs/authentication/src/lib/sign-out.directive.ts","../../../../libs/authentication/src/rxap-authentication.ts"],"sourcesContent":["import {\n Injectable,\n Inject,\n Optional\n} from '@angular/core';\nimport {\n BehaviorSubject,\n Observable,\n Subject,\n ReplaySubject\n} from 'rxjs';\nimport { Router } from '@angular/router';\nimport { tap } from 'rxjs/operators';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\n\nexport const RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY = 'rxap__authenticated';\n\nexport interface IAuthenticationService {\n isAuthenticated$: Observable<boolean | null>;\n\n requestPasswordReset(email: string): Promise<boolean>;\n\n sendPasswordReset(password: string, token: string): Promise<boolean>;\n\n signInWithEmailAndPassword(email: string, password: string, remember: boolean): Promise<boolean>;\n\n signOut(): Promise<void>;\n\n}\n\nexport function TimeoutPromise<T>(callback: (resolve: (value: T) => void, reject: (error: any) => void) => void, ms: number): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n\n setTimeout(() => {\n callback(resolve, reject);\n }, ms);\n\n });\n}\n\nexport function TimeoutResolve<T>(value: T, ms: number): Promise<T> {\n return new Promise(resolve => {\n\n setTimeout(() => {\n resolve(value);\n }, ms);\n\n });\n}\n\nexport enum AuthenticationEventType {\n OnAuthSuccess = 'on-auth-success',\n OnAuthError = 'on-auth-error',\n OnLogout = 'on-logout',\n}\n\nexport interface AuthenticationEvent extends Record<string, any> {\n type: AuthenticationEventType;\n}\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class RxapAuthenticationService implements IAuthenticationService {\n\n public isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n public readonly events$ = new ReplaySubject<AuthenticationEvent>();\n\n constructor() {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));\n }\n\n public requestPasswordReset(email: string): Promise<boolean> {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n return TimeoutResolve(email !== 'fail@fail', 2500);\n }\n\n public sendPasswordReset(password: string, token: string): Promise<boolean> {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n return TimeoutResolve(password !== 'fail', 2500);\n }\n\n public async signInWithEmailAndPassword(email: string, password: string, remember: boolean): Promise<boolean> {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n return TimeoutPromise((resolve, reject) => {\n\n const login = password !== 'fail';\n this.isAuthenticated$.next(login);\n if (login) {\n if (remember) {\n localStorage.setItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY, 'true');\n }\n resolve(login);\n this.events$.next({ type: AuthenticationEventType.OnAuthSuccess });\n } else {\n localStorage.removeItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY);\n reject(new Error('Login credentials are invalid'));\n this.events$.next({ type: AuthenticationEventType.OnAuthError });\n }\n\n }, 2500);\n\n }\n\n public async signOut(): Promise<void> {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n this.isAuthenticated$.next(false);\n localStorage.removeItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY);\n this.events$.next({ type: AuthenticationEventType.OnLogout });\n }\n\n public signInWithProvider(provider: string): Promise<boolean> {\n console.warn('The default RxapAuthenticationService implementation should only be used in a development environment!');\n return Promise.resolve(false);\n }\n\n public isAuthenticated(): Promise<boolean> {\n return TimeoutPromise((resolve) => {\n resolve(localStorage.getItem(RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY) === 'true');\n }, 2500);\n }\n\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken<boolean>('rxap/authentication/deactivated');\n","import {\n Injectable,\n Inject,\n Optional\n} from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { RxapAuthenticationService } from './authentication.service';\nimport {\n map,\n first,\n take\n} from 'rxjs/operators';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationGuard {\n\n public lastUrl: string | null = null;\n\n constructor(\n @Inject(RxapAuthenticationService)\n public authentication: RxapAuthenticationService,\n @Inject(Router)\n public router: Router,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null\n ) {}\n\n public canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate', state.url);\n return this.checkAuthStatus(route, state);\n }\n\n public canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate child', state.url);\n return this.checkAuthStatus(childRoute, state);\n }\n\n private async checkAuthStatus(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Promise<UrlTree | boolean> {\n\n if (this.deactivated) {\n return true;\n }\n\n const authenticated = await this.authentication.isAuthenticated();\n\n if (authenticated === null) {\n if (!this.lastUrl || (state.url !== '/' && !state.url.match(/authentication\\/login/))) {\n this.lastUrl = state.url;\n }\n return this.router.createUrlTree([ '/', 'authentication', 'loading' ]);\n }\n if (authenticated) {\n if (this.lastUrl && (state.url/*?*/ === '/' || state.url.match(/authentication\\/login/))) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n } else {\n if (state.url.match(/authentication/)) {\n if (state.url.match(/authentication\\/reset-password/)) {\n return true;\n }\n return this.router.createUrlTree([ '/' ]);\n } else {\n this.lastUrl = null;\n return true;\n }\n }\n } else {\n if (!state.url.match(/^\\/?authentication/)) {\n this.lastUrl = state.url;\n }\n if (state.url.match(/^\\/?authentication/)) {\n if (this.lastUrl && this.lastUrl.match(/^\\/?authentication/)) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n }\n return true;\n } else {\n return this.router.createUrlTree([ '/', 'authentication', 'login' ]);\n }\n }\n\n }\n\n private createUrlTreeToLastUrl(lastUrl: string): UrlTree {\n\n const urlMatch = lastUrl.match(/^([^?#]+)(\\?([^#]+))?(#(.+))?$/);\n\n if (urlMatch) {\n\n let queryParams: Record<string, string> = {};\n\n if (urlMatch[3]) {\n const queryParamsString = urlMatch[ 3 ];\n queryParams = queryParamsString.split('&').map(param => {\n const split = param.split('=');\n return { [ split[ 0 ] ]: split[ 1 ] };\n }).reduce((params, param) => ({ ...params, ...param }), {});\n }\n\n let fragment: string | undefined = undefined;\n\n if (urlMatch[5]) {\n fragment = urlMatch[5];\n }\n\n return this.router.createUrlTree([urlMatch[1]], {\n queryParams,\n fragment,\n });\n\n }\n\n return this.router.createUrlTree([lastUrl]);\n\n }\n\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class RegisterService {\n\n constructor() {\n console.warn('The default RegisterService implementation should only be used in a development environment!');\n }\n\n public register(email: string, password: string): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nexport interface UserProfile {\n username: string;\n firstname?: string;\n lastname?: string;\n name?: string;\n email: string;\n photoURL?: string;\n avatarUrl?: string;\n}\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class UserService<User extends UserProfile = UserProfile> {\n\n public user$ = new BehaviorSubject<User | null>(null);\n\n}\n","import {\n Injectable,\n Inject,\n Optional\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\nimport { tap } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthenticationRoutingService {\n\n constructor(\n @Inject(Router)\n private readonly router: Router,\n @Inject(RxapAuthenticationService)\n private readonly authenticationService: RxapAuthenticationService,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null\n ) {\n if (!deactivated) {\n console.log('Authentication is enabled');\n this.authenticationService.isAuthenticated$.pipe(\n tap(isAuthenticated => {\n if (isAuthenticated) {\n return this.router.navigate([ '/' ]);\n } else {\n return this.router.navigate([ '/', 'authentication', 'login' ]);\n }\n })\n ).subscribe();\n }\n }\n\n}\n","import {\n Directive,\n HostListener,\n EventEmitter,\n Output\n} from '@angular/core';\nimport { RxapAuthenticationService } from './authentication.service';\n\n@Directive({\n selector: '[rxapSignOut]',\n standalone: true\n})\nexport class SignOutDirective {\n\n @Output()\n public successful = new EventEmitter<void>();\n\n @Output()\n public failure = new EventEmitter<Error>();\n\n constructor(private readonly auth: RxapAuthenticationService) { }\n\n @HostListener('click')\n public async onClick() {\n try {\n await this.auth.signOut();\n this.successful.emit();\n } catch (e: any) {\n this.failure.emit(e);\n }\n }\n\n}\n\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.RxapAuthenticationService"],"mappings":";;;;;;;AAeO,MAAM,qCAAqC,GAAG,sBAAsB;AAe3D,SAAA,cAAc,CAAI,QAA6E,EAAE,EAAU,EAAA;IACzH,OAAO,IAAI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AS,CAAC;KAEsB;AAG1D,IAAA,MAAM,OAAO,GAAA;QAClB,IAAI;AACF,YAAA,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AAC1B,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;AACxB,SAAA;AAAC,QAAA,OAAO,CAAM,EAAE;AACf,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtB,SAAA;KACF;8GAlBU,gBAAgB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAA,yBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAI,eAAe;AAC3B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;6GAIQ,UAAU,EAAA,CAAA;sBADhB,MAAM;gBAIA,OAAO,EAAA,CAAA;sBADb,MAAM;gBAMM,OAAO,EAAA,CAAA;sBADnB,YAAY;uBAAC,OAAO,CAAA;;;ACtBvB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rxap-authentication.mjs","sources":["../../../../../packages/angular/authentication/src/lib/tokens.ts","../../../../../packages/angular/authentication/src/lib/authentication.service.ts","../../../../../packages/angular/authentication/src/lib/authentication-routing.service.ts","../../../../../packages/angular/authentication/src/lib/authentication.guard.ts","../../../../../packages/angular/authentication/src/lib/bearer-token.interceptor.ts","../../../../../packages/angular/authentication/src/lib/register.service.ts","../../../../../packages/angular/authentication/src/lib/sign-out.directive.ts","../../../../../packages/angular/authentication/src/index.ts","../../../../../packages/angular/authentication/src/rxap-authentication.ts"],"sourcesContent":["import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nexport const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken<boolean>('rxap/authentication/deactivated');\n\nexport interface AuthenticationAccessToken extends Record<string, any> {\n token: string;\n valid?: boolean;\n}\n\nexport const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>(\n 'rxap/authentication/access-token',\n {\n providedIn: 'root',\n factory: () => new BehaviorSubject<AuthenticationAccessToken | null>(null),\n },\n);\n\nexport const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken<boolean>('rxap/authentication/initial-state', {\n providedIn: 'root',\n factory: () => false,\n});\n\nexport function withDisabledAuthentication(disabled = true): Provider {\n return {\n provide: RXAP_AUTHENTICATION_DEACTIVATED,\n useValue: disabled,\n };\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n BehaviorSubject,\n Observable,\n ReplaySubject,\n} from 'rxjs';\nimport { RXAP_INITIAL_AUTHENTICATION_STATE } from './tokens';\n\nexport interface IAuthenticationService {\n isAuthenticated$: Observable<boolean | null>;\n events$: Observable<AuthenticationEvent>;\n signOut(): Promise<void>;\n\n isAuthenticated(): Promise<boolean>;\n}\n\nexport enum AuthenticationEventType {\n OnAuthSuccess = 'on-auth-success',\n OnAuthError = 'on-auth-error',\n OnLogout = 'on-logout',\n}\n\nexport interface AuthenticationEvent extends Record<string, any> {\n type: AuthenticationEventType;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationService implements IAuthenticationService {\n\n public isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n public readonly events$ = new ReplaySubject<AuthenticationEvent>();\n\n private _authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);\n\n constructor() {\n this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));\n }\n\n public async signOut(): Promise<void> {\n this._authenticated = false;\n this.isAuthenticated$.next(this._authenticated);\n this.events$.next({ type: AuthenticationEventType.OnLogout });\n }\n\n public isAuthenticated(): Promise<boolean> {\n return Promise.resolve(this._authenticated);\n }\n\n}\n","import {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\nimport { tap } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthenticationRoutingService {\n\n constructor(\n @Inject(Router)\n private readonly router: Router,\n @Inject(RxapAuthenticationService)\n private readonly authenticationService: RxapAuthenticationService,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null,\n ) {\n if (!deactivated) {\n console.log('Authentication is enabled');\n this.authenticationService.isAuthenticated$.pipe(\n tap(isAuthenticated => {\n if (isAuthenticated) {\n return this.router.navigate([ '/' ]);\n } else {\n return this.router.navigate([ '/', 'authentication', 'login' ]);\n }\n }),\n ).subscribe();\n }\n }\n\n}\n","import {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationGuard {\n\n public lastUrl: string | null = null;\n\n constructor(\n @Inject(RxapAuthenticationService)\n public authentication: RxapAuthenticationService,\n @Inject(Router)\n public router: Router,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null,\n ) {\n }\n\n public canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate', state.url);\n return this.checkAuthStatus(route, state);\n }\n\n public canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate child', state.url);\n return this.checkAuthStatus(childRoute, state);\n }\n\n private async checkAuthStatus(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n\n if (this.deactivated) {\n return true;\n }\n\n const authenticated = await this.authentication.isAuthenticated();\n\n if (authenticated === null) {\n if (!this.lastUrl || (state.url !== '/' && !state.url.match(/authentication\\/login/))) {\n this.lastUrl = state.url;\n }\n return this.router.createUrlTree([ '/', 'authentication', 'loading' ]);\n }\n if (authenticated) {\n if (this.lastUrl && (state.url/*?*/ === '/' || state.url.match(/authentication\\/login/))) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n } else {\n if (state.url.match(/authentication/)) {\n if (state.url.match(/authentication\\/reset-password/)) {\n return true;\n }\n return this.router.createUrlTree([ '/' ]);\n } else {\n this.lastUrl = null;\n return true;\n }\n }\n } else {\n if (!state.url.match(/^\\/?authentication/)) {\n this.lastUrl = state.url;\n }\n if (state.url.match(/^\\/?authentication/)) {\n if (this.lastUrl && this.lastUrl.match(/^\\/?authentication/)) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n }\n return true;\n } else {\n return this.router.createUrlTree([ '/', 'authentication', 'login' ]);\n }\n }\n\n }\n\n private createUrlTreeToLastUrl(lastUrl: string): UrlTree {\n\n const urlMatch = lastUrl.match(/^([^?#]+)(\\?([^#]+))?(#(.+))?$/);\n\n if (urlMatch) {\n\n let queryParams: Record<string, string> = {};\n\n if (urlMatch[3]) {\n const queryParamsString = urlMatch[3];\n queryParams = queryParamsString.split('&').map(param => {\n const split = param.split('=');\n return { [split[0]]: split[1] };\n }).reduce((params, param) => ({ ...params, ...param }), {});\n }\n\n let fragment: string | undefined = undefined;\n\n if (urlMatch[5]) {\n fragment = urlMatch[5];\n }\n\n return this.router.createUrlTree([ urlMatch[1] ], {\n queryParams,\n fragment,\n });\n\n }\n\n return this.router.createUrlTree([ lastUrl ]);\n\n }\n\n}\n","import {\n HttpEvent,\n HttpHandlerFn,\n HttpRequest,\n} from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport {\n Observable,\n switchMap,\n take,\n} from 'rxjs';\nimport { RXAP_AUTHENTICATION_ACCESS_TOKEN } from './tokens';\n\nexport function BearerTokenInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>> {\n\n const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);\n\n if (req.url.match(/https?:\\/\\/[^/]+\\/api/)) {\n return accessToken$.pipe(\n take(1),\n switchMap(accessToken => {\n if (accessToken && (accessToken.valid === undefined || accessToken.valid)) {\n console.debug('Add access token to request', req.url);\n return next(req.clone({\n setHeaders: {\n Authorization: `Bearer ${ accessToken.token }`,\n },\n }));\n } else {\n console.debug('No valid access token found!', req.url);\n }\n return next(req);\n }),\n );\n } else {\n console.debug('Skip adding access token to request', req.url);\n }\n\n return next(req);\n\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class RegisterService {\n\n constructor() {\n console.warn('The default RegisterService implementation should only be used in a development environment!');\n }\n\n public register(email: string, password: string): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n}\n","import {\n Directive,\n EventEmitter,\n HostListener,\n Output,\n} from '@angular/core';\nimport { RxapAuthenticationService } from './authentication.service';\n\n@Directive({\n selector: '[rxapSignOut]',\n standalone: true,\n})\nexport class SignOutDirective {\n\n @Output()\n public successful = new EventEmitter<void>();\n\n @Output()\n public failure = new EventEmitter<Error>();\n\n constructor(private readonly auth: RxapAuthenticationService) {\n }\n\n @HostListener('click')\n public async onClick() {\n try {\n await this.auth.signOut();\n this.successful.emit();\n } catch (e: any) {\n this.failure.emit(e);\n }\n }\n\n}\n\n\n","// region \nexport * from './lib/authentication-routing.service';\nexport * from './lib/authentication.guard';\nexport * from './lib/authentication.service';\nexport * from './lib/bearer-token.interceptor';\nexport * from './lib/register.service';\nexport * from './lib/sign-out.directive';\nexport * from './lib/tokens';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.RxapAuthenticationService"],"mappings":";;;;;;;MAMa,+BAA+B,GAAG,IAAI,cAAc,CAAU,iCAAiC,EAAE;MAOjG,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC,EAClC;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,IAAI,eAAe,CAAmC,IAAI,CAAC;AAC3E,CAAA,EACD;MAEW,iCAAiC,GAAG,IAAI,cAAc,CAAU,mCAAmC,EAAE;AAChH,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,KAAK;AACrB,CAAA,EAAE;AAEa,SAAA,0BAA0B,CAAC,QAAQ,GAAG,IAAI,EAAA;IACxD,OAAO;AACL,QAAA,OAAO,EAAE,+BAA+B;AACxC,QAAA,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ;;ICZY,wBAIX;AAJD,CAAA,UAAY,uBAAuB,EAAA;AACjC,IAAA,uBAAA,CAAA,eAAA,CAAA,GAAA,iBAAiC,CAAA;AACjC,IAAA,uBAAA,CAAA,aAAA,CAAA,GAAA,eAA6B,CAAA;AAC7B,IAAA,uBAAA,CAAA,UAAA,CAAA,GAAA,WAAsB,CAAA;AACxB,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,GAIlC,EAAA,CAAA,CAAA,CAAA;MAOY,yBAAyB,CAAA;AAQpC,IAAA,WAAA,GAAA;AANO,QAAA,IAAA,C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;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;6GAIQ,UAAU,EAAA,CAAA;sBADhB,MAAM;gBAIA,OAAO,EAAA,CAAA;sBADb,MAAM;gBAOM,OAAO,EAAA,CAAA;sBADnB,YAAY;uBAAC,OAAO,CAAA;;;ACvBvB;AAQA;;ACRA;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from './lib/authentication-routing.service';
|
|
1
2
|
export * from './lib/authentication.guard';
|
|
2
3
|
export * from './lib/authentication.service';
|
|
4
|
+
export * from './lib/bearer-token.interceptor';
|
|
3
5
|
export * from './lib/register.service';
|
|
4
|
-
export * from './lib/user.service';
|
|
5
|
-
export * from './lib/authentication-routing.service';
|
|
6
|
-
export * from './lib/tokens';
|
|
7
6
|
export * from './lib/sign-out.directive';
|
|
7
|
+
export * from './lib/tokens';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree
|
|
1
|
+
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
2
2
|
import { RxapAuthenticationService } from './authentication.service';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class RxapAuthenticationGuard {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable, ReplaySubject } from 'rxjs';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare const RXAP_AUTHENTICATION_LOCAL_STORAGE_KEY = "rxap__authenticated";
|
|
4
3
|
export interface IAuthenticationService {
|
|
5
4
|
isAuthenticated$: Observable<boolean | null>;
|
|
6
|
-
|
|
7
|
-
sendPasswordReset(password: string, token: string): Promise<boolean>;
|
|
8
|
-
signInWithEmailAndPassword(email: string, password: string, remember: boolean): Promise<boolean>;
|
|
5
|
+
events$: Observable<AuthenticationEvent>;
|
|
9
6
|
signOut(): Promise<void>;
|
|
7
|
+
isAuthenticated(): Promise<boolean>;
|
|
10
8
|
}
|
|
11
|
-
export declare function TimeoutPromise<T>(callback: (resolve: (value: T) => void, reject: (error: any) => void) => void, ms: number): Promise<T>;
|
|
12
|
-
export declare function TimeoutResolve<T>(value: T, ms: number): Promise<T>;
|
|
13
9
|
export declare enum AuthenticationEventType {
|
|
14
10
|
OnAuthSuccess = "on-auth-success",
|
|
15
11
|
OnAuthError = "on-auth-error",
|
|
@@ -21,12 +17,9 @@ export interface AuthenticationEvent extends Record<string, any> {
|
|
|
21
17
|
export declare class RxapAuthenticationService implements IAuthenticationService {
|
|
22
18
|
isAuthenticated$: BehaviorSubject<boolean | null>;
|
|
23
19
|
readonly events$: ReplaySubject<AuthenticationEvent>;
|
|
20
|
+
private _authenticated;
|
|
24
21
|
constructor();
|
|
25
|
-
requestPasswordReset(email: string): Promise<boolean>;
|
|
26
|
-
sendPasswordReset(password: string, token: string): Promise<boolean>;
|
|
27
|
-
signInWithEmailAndPassword(email: string, password: string, remember: boolean): Promise<boolean>;
|
|
28
22
|
signOut(): Promise<void>;
|
|
29
|
-
signInWithProvider(provider: string): Promise<boolean>;
|
|
30
23
|
isAuthenticated(): Promise<boolean>;
|
|
31
24
|
static ɵfac: i0.ɵɵFactoryDeclaration<RxapAuthenticationService, never>;
|
|
32
25
|
static ɵprov: i0.ɵɵInjectableDeclaration<RxapAuthenticationService>;
|
package/lib/tokens.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
3
|
export declare const RXAP_AUTHENTICATION_DEACTIVATED: InjectionToken<boolean>;
|
|
4
|
+
export interface AuthenticationAccessToken extends Record<string, any> {
|
|
5
|
+
token: string;
|
|
6
|
+
valid?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const RXAP_AUTHENTICATION_ACCESS_TOKEN: InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>;
|
|
9
|
+
export declare const RXAP_INITIAL_AUTHENTICATION_STATE: InjectionToken<boolean>;
|
|
10
|
+
export declare function withDisabledAuthentication(disabled?: boolean): Provider;
|
package/package.json
CHANGED
|
@@ -1,69 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
+
"version": "16.0.0-dev.21",
|
|
2
3
|
"name": "@rxap/authentication",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
4
|
+
"description": "A collection of components and services to simplify the authentication process implementation.",
|
|
5
|
+
"license": "GPL-3.0-or-later",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"tslib": "2.6.2"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@angular/common": "^16.1.4",
|
|
11
|
+
"@angular/core": "^16.1.4",
|
|
12
|
+
"@angular/router": "^16.1.4",
|
|
13
|
+
"rxjs": "^7.8.1"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Merzough Münker",
|
|
17
|
+
"email": "mmuenker@digitaix.com"
|
|
18
|
+
},
|
|
14
19
|
"bugs": {
|
|
15
20
|
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
16
21
|
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
17
22
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
23
|
+
"homepage": "https:/gitlab.com/rxap/packages/packages/angular/authentication",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"angular",
|
|
26
|
+
"angular-authentication",
|
|
27
|
+
"authentication",
|
|
28
|
+
"ngx",
|
|
29
|
+
"packages",
|
|
30
|
+
"rxap"
|
|
31
|
+
],
|
|
32
|
+
"nx-migrations": {
|
|
21
33
|
"packageGroup": [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
{
|
|
35
|
+
"package": "@rxap/config",
|
|
36
|
+
"version": "16.0.0-dev.15"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"package": "@rxap/forms",
|
|
40
|
+
"version": "16.0.0-dev.16"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"package": "@rxap/rxjs",
|
|
44
|
+
"version": "1.0.1-dev.10"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"package": "@rxap/utilities",
|
|
48
|
+
"version": "16.0.0-dev.17"
|
|
49
|
+
}
|
|
29
50
|
]
|
|
30
51
|
},
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@angular-devkit/schematics": "^15.0.3",
|
|
33
|
-
"@angular/animations": "^16.0.2",
|
|
34
|
-
"@angular/cdk": "^16.0.1",
|
|
35
|
-
"@angular/common": "^16.0.2",
|
|
36
|
-
"@angular/core": "^16.0.2",
|
|
37
|
-
"@angular/flex-layout": "^15.0.0-beta.42",
|
|
38
|
-
"@angular/forms": "^16.0.2",
|
|
39
|
-
"@angular/localize": "^16.0.2",
|
|
40
|
-
"@angular/material": "^16.0.1",
|
|
41
|
-
"@angular/platform-browser": "^16.0.2",
|
|
42
|
-
"@angular/platform-browser-dynamic": "^16.0.2",
|
|
43
|
-
"@angular/router": "^16.0.2",
|
|
44
|
-
"@rxap/config": "^16.0.0-dev.2",
|
|
45
|
-
"@rxap/definition": "^16.0.0-dev.2",
|
|
46
|
-
"@rxap/directives": "^16.0.0-dev.2",
|
|
47
|
-
"@rxap/forms": "^16.0.0-dev.2",
|
|
48
|
-
"@rxap/services": "^16.0.0-dev.2",
|
|
49
|
-
"@rxap/utilities": "^16.0.0-dev.1",
|
|
50
|
-
"joi": "^17.6.3",
|
|
51
|
-
"reflect-metadata": "^0.1.13",
|
|
52
|
-
"rxjs": "^6.6.0"
|
|
53
|
-
},
|
|
54
|
-
"schematics": "./collection.json",
|
|
55
52
|
"publishConfig": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
},
|
|
59
|
-
"ng-add": {
|
|
60
|
-
"save": "dependencies"
|
|
53
|
+
"access": "public",
|
|
54
|
+
"directory": "../../../dist/packages/angular/authentication"
|
|
61
55
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://gitlab.com/rxap/packages.git",
|
|
59
|
+
"directory": "packages/angular/authentication"
|
|
66
60
|
},
|
|
61
|
+
"sideEffects": false,
|
|
62
|
+
"gitHead": "20b8dac595e9a039100287e24bbaa23738da7672",
|
|
67
63
|
"module": "fesm2022/rxap-authentication.mjs",
|
|
68
64
|
"typings": "index.d.ts",
|
|
69
65
|
"exports": {
|
|
@@ -76,12 +72,6 @@
|
|
|
76
72
|
"esm": "./esm2022/rxap-authentication.mjs",
|
|
77
73
|
"default": "./fesm2022/rxap-authentication.mjs"
|
|
78
74
|
},
|
|
79
|
-
"./
|
|
80
|
-
|
|
81
|
-
"esm2022": "./esm2022/components/rxap-authentication-components.mjs",
|
|
82
|
-
"esm": "./esm2022/components/rxap-authentication-components.mjs",
|
|
83
|
-
"default": "./fesm2022/rxap-authentication-components.mjs"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"sideEffects": false
|
|
75
|
+
"./theme": "./theme.css"
|
|
76
|
+
}
|
|
87
77
|
}
|
package/theme.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.block{display:block}.inline{display:inline}.contents{display:contents}.hidden{display:none}.capitalize{text-transform:capitalize}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}
|
package/collection.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schematics": {
|
|
3
|
-
"ng-add": {
|
|
4
|
-
"description": "Setup the package @rxap/authentication for the workspace.",
|
|
5
|
-
"factory": "./src/schematics/ng-add/index",
|
|
6
|
-
"schema": "./src/schematics/ng-add/schema.json"
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
"$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
|
|
10
|
-
}
|
package/components/README.md
DELETED