@daffodil/auth 0.56.1 → 0.58.0
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/driver/public_api.d.ts +1 -0
- package/driver/services/auth-check.service.d.ts +17 -0
- package/driver/services/public_api.d.ts +1 -0
- package/errors/codes.enum.d.ts +3 -0
- package/errors/map.d.ts +7 -0
- package/errors/missing-token.d.ts +10 -0
- package/errors/public_api.d.ts +3 -0
- package/esm2020/driver/public_api.mjs +2 -1
- package/esm2020/driver/services/auth-check.service.mjs +38 -0
- package/esm2020/driver/services/public_api.mjs +2 -0
- package/esm2020/errors/codes.enum.mjs +5 -0
- package/esm2020/errors/map.mjs +9 -0
- package/esm2020/errors/missing-token.mjs +14 -0
- package/esm2020/errors/public_api.mjs +4 -0
- package/esm2020/public_api.mjs +2 -1
- package/esm2020/routing/config/default.mjs +2 -1
- package/esm2020/routing/config/interface.mjs +1 -1
- package/esm2020/routing/effects/redirect.effects.mjs +13 -5
- package/esm2020/routing/guards/guest-only.guard.mjs +28 -15
- package/esm2020/routing/guards/member-only.guard.mjs +28 -15
- package/esm2020/state/actions/auth.actions.mjs +11 -40
- package/esm2020/state/actions/reset-password.actions.mjs +3 -2
- package/esm2020/state/effects/auth.effects.mjs +22 -23
- package/esm2020/state/effects/login.effects.mjs +7 -7
- package/esm2020/state/effects/register.effects.mjs +3 -3
- package/esm2020/state/effects/reset-password.effects.mjs +3 -3
- package/esm2020/state/reducers/auth/auth.reducer.mjs +11 -4
- package/fesm2015/daffodil-auth-driver.mjs +40 -2
- package/fesm2015/daffodil-auth-driver.mjs.map +1 -1
- package/fesm2015/daffodil-auth-routing.mjs +63 -31
- package/fesm2015/daffodil-auth-routing.mjs.map +1 -1
- package/fesm2015/daffodil-auth-state.mjs +52 -77
- package/fesm2015/daffodil-auth-state.mjs.map +1 -1
- package/fesm2015/daffodil-auth.mjs +26 -2
- package/fesm2015/daffodil-auth.mjs.map +1 -1
- package/fesm2020/daffodil-auth-driver.mjs +38 -2
- package/fesm2020/daffodil-auth-driver.mjs.map +1 -1
- package/fesm2020/daffodil-auth-routing.mjs +62 -30
- package/fesm2020/daffodil-auth-routing.mjs.map +1 -1
- package/fesm2020/daffodil-auth-state.mjs +55 -77
- package/fesm2020/daffodil-auth-state.mjs.map +1 -1
- package/fesm2020/daffodil-auth.mjs +26 -2
- package/fesm2020/daffodil-auth.mjs.map +1 -1
- package/package.json +3 -3
- package/public_api.d.ts +1 -0
- package/routing/config/interface.d.ts +5 -0
- package/routing/effects/redirect.effects.d.ts +3 -1
- package/routing/guards/guest-only.guard.d.ts +9 -5
- package/routing/guards/member-only.guard.d.ts +9 -5
- package/state/actions/auth.actions.d.ts +8 -34
- package/state/actions/reset-password.actions.d.ts +2 -0
- package/state/effects/auth.effects.d.ts +10 -9
- package/state/effects/login.effects.d.ts +4 -4
- package/state/effects/register.effects.d.ts +2 -1
- package/state/effects/reset-password.effects.d.ts +2 -2
- package/state/reducers/auth/auth.reducer.d.ts +2 -2
|
@@ -1,43 +1,57 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i3 from '@angular/router';
|
|
4
|
-
import * as
|
|
5
|
-
import { ofType, createEffect, EffectsModule } from '@ngrx/effects';
|
|
6
|
-
import { tap, map, switchMap } from 'rxjs/operators';
|
|
7
|
-
import * as i1 from '@daffodil/auth/state';
|
|
8
|
-
import { DaffAuthGuardCheck, DaffAuthActionTypes, DaffResetPasswordLanding } from '@daffodil/auth/state';
|
|
4
|
+
import * as i4 from '@ngrx/store';
|
|
9
5
|
import { of, EMPTY } from 'rxjs';
|
|
6
|
+
import { tap, map, catchError, filter, switchMap } from 'rxjs/operators';
|
|
7
|
+
import * as i2 from '@daffodil/auth';
|
|
8
|
+
import { DAFF_AUTH_ERROR_MATCHER } from '@daffodil/auth';
|
|
9
|
+
import * as i1 from '@daffodil/auth/driver';
|
|
10
|
+
import { DaffAuthDriverErrorCodes } from '@daffodil/auth/driver';
|
|
11
|
+
import * as i1$1 from '@daffodil/auth/state';
|
|
12
|
+
import { DaffAuthGuardLogout, DaffResetPasswordLanding, DaffAuthLoginActionTypes, DaffAuthRegisterActionTypes, DaffAuthResetPasswordActionTypes, DaffAuthActionTypes } from '@daffodil/auth/state';
|
|
13
|
+
import * as i1$2 from '@ngrx/effects';
|
|
14
|
+
import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
|
10
15
|
|
|
11
16
|
const DaffAuthMemberOnlyGuardRedirectUrl = new InjectionToken('DaffAuthMemberOnlyGuardRedirectUrl', { factory: () => '/' });
|
|
12
17
|
|
|
13
18
|
class MemberOnlyGuard {
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
19
|
+
constructor(tokenCheck, storage, router, store, errorMatcher, redirectUrl) {
|
|
20
|
+
this.tokenCheck = tokenCheck;
|
|
21
|
+
this.storage = storage;
|
|
17
22
|
this.router = router;
|
|
23
|
+
this.store = store;
|
|
24
|
+
this.errorMatcher = errorMatcher;
|
|
18
25
|
this.redirectUrl = redirectUrl;
|
|
19
26
|
}
|
|
20
27
|
canActivate() {
|
|
21
|
-
|
|
28
|
+
return this.isAuthenticated().pipe(tap(result => {
|
|
22
29
|
if (!result) {
|
|
23
30
|
this.router.navigateByUrl(this.redirectUrl);
|
|
24
31
|
}
|
|
25
32
|
}));
|
|
26
|
-
this.facade.dispatch(new DaffAuthGuardCheck());
|
|
27
|
-
return ret;
|
|
28
33
|
}
|
|
29
34
|
isAuthenticated() {
|
|
30
|
-
return this.
|
|
35
|
+
return this.tokenCheck.check().pipe(map(() => true), catchError((error) => {
|
|
36
|
+
if (error.code === DaffAuthDriverErrorCodes.UNAUTHORIZED) {
|
|
37
|
+
this.storage.removeAuthToken();
|
|
38
|
+
this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));
|
|
39
|
+
}
|
|
40
|
+
return of(false);
|
|
41
|
+
}));
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
|
-
/** @nocollapse */ MemberOnlyGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MemberOnlyGuard, deps: [{ token: i1.
|
|
44
|
+
/** @nocollapse */ MemberOnlyGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MemberOnlyGuard, deps: [{ token: i1.DaffAuthDriverTokenCheck }, { token: i2.DaffAuthStorageService }, { token: i3.Router }, { token: i4.Store }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: DaffAuthMemberOnlyGuardRedirectUrl }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
45
|
/** @nocollapse */ MemberOnlyGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MemberOnlyGuard, providedIn: 'any' });
|
|
35
46
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MemberOnlyGuard, decorators: [{
|
|
36
47
|
type: Injectable,
|
|
37
48
|
args: [{
|
|
38
49
|
providedIn: 'any',
|
|
39
50
|
}]
|
|
40
|
-
}], ctorParameters: function () { return [{ type: i1.
|
|
51
|
+
}], ctorParameters: function () { return [{ type: i1.DaffAuthDriverTokenCheck }, { type: i2.DaffAuthStorageService }, { type: i3.Router }, { type: i4.Store }, { type: undefined, decorators: [{
|
|
52
|
+
type: Inject,
|
|
53
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
54
|
+
}] }, { type: undefined, decorators: [{
|
|
41
55
|
type: Inject,
|
|
42
56
|
args: [DaffAuthMemberOnlyGuardRedirectUrl]
|
|
43
57
|
}] }]; } });
|
|
@@ -45,33 +59,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
45
59
|
const DaffAuthGuestOnlyGuardRedirectUrl = new InjectionToken('DaffAuthGuestOnlyGuardRedirectUrl', { factory: () => '/' });
|
|
46
60
|
|
|
47
61
|
class GuestOnlyGuard {
|
|
48
|
-
constructor(
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
62
|
+
constructor(tokenCheck, storage, router, store, errorMatcher, redirectUrl) {
|
|
63
|
+
this.tokenCheck = tokenCheck;
|
|
64
|
+
this.storage = storage;
|
|
51
65
|
this.router = router;
|
|
66
|
+
this.store = store;
|
|
67
|
+
this.errorMatcher = errorMatcher;
|
|
52
68
|
this.redirectUrl = redirectUrl;
|
|
53
69
|
}
|
|
54
70
|
canActivate() {
|
|
55
|
-
|
|
71
|
+
return this.isUnauthenticated().pipe(tap(result => {
|
|
56
72
|
if (!result) {
|
|
57
73
|
this.router.navigateByUrl(this.redirectUrl);
|
|
58
74
|
}
|
|
59
75
|
}));
|
|
60
|
-
this.facade.dispatch(new DaffAuthGuardCheck());
|
|
61
|
-
return ret;
|
|
62
76
|
}
|
|
63
77
|
isUnauthenticated() {
|
|
64
|
-
return this.
|
|
78
|
+
return this.tokenCheck.check().pipe(map(() => false), catchError((error) => {
|
|
79
|
+
if (error.code === DaffAuthDriverErrorCodes.UNAUTHORIZED) {
|
|
80
|
+
this.storage.removeAuthToken();
|
|
81
|
+
this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));
|
|
82
|
+
}
|
|
83
|
+
return of(true);
|
|
84
|
+
}));
|
|
65
85
|
}
|
|
66
86
|
}
|
|
67
|
-
/** @nocollapse */ GuestOnlyGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, deps: [{ token: i1.
|
|
87
|
+
/** @nocollapse */ GuestOnlyGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, deps: [{ token: i1.DaffAuthDriverTokenCheck }, { token: i2.DaffAuthStorageService }, { token: i3.Router }, { token: i4.Store }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: DaffAuthGuestOnlyGuardRedirectUrl }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
68
88
|
/** @nocollapse */ GuestOnlyGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, providedIn: 'any' });
|
|
69
89
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, decorators: [{
|
|
70
90
|
type: Injectable,
|
|
71
91
|
args: [{
|
|
72
92
|
providedIn: 'any',
|
|
73
93
|
}]
|
|
74
|
-
}], ctorParameters: function () { return [{ type: i1.
|
|
94
|
+
}], ctorParameters: function () { return [{ type: i1.DaffAuthDriverTokenCheck }, { type: i2.DaffAuthStorageService }, { type: i3.Router }, { type: i4.Store }, { type: undefined, decorators: [{
|
|
95
|
+
type: Inject,
|
|
96
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
97
|
+
}] }, { type: undefined, decorators: [{
|
|
75
98
|
type: Inject,
|
|
76
99
|
args: [DaffAuthGuestOnlyGuardRedirectUrl]
|
|
77
100
|
}] }]; } });
|
|
@@ -80,6 +103,7 @@ const DAFF_AUTH_ROUTING_CONFIG_DEFAULT = {
|
|
|
80
103
|
resetPasswordTokenParam: 'token',
|
|
81
104
|
authCompleteRedirectPath: '/',
|
|
82
105
|
logoutRedirectPath: '/',
|
|
106
|
+
tokenExpirationRedirectPath: '/',
|
|
83
107
|
};
|
|
84
108
|
|
|
85
109
|
/**
|
|
@@ -110,14 +134,14 @@ class DaffAuthResetPasswordGuard {
|
|
|
110
134
|
return of(true);
|
|
111
135
|
}
|
|
112
136
|
}
|
|
113
|
-
/** @nocollapse */ DaffAuthResetPasswordGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, deps: [{ token: i1.DaffAuthFacade }, { token: DAFF_AUTH_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
137
|
+
/** @nocollapse */ DaffAuthResetPasswordGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, deps: [{ token: i1$1.DaffAuthFacade }, { token: DAFF_AUTH_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
114
138
|
/** @nocollapse */ DaffAuthResetPasswordGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, providedIn: 'any' });
|
|
115
139
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, decorators: [{
|
|
116
140
|
type: Injectable,
|
|
117
141
|
args: [{
|
|
118
142
|
providedIn: 'any',
|
|
119
143
|
}]
|
|
120
|
-
}], ctorParameters: function () { return [{ type: i1.DaffAuthFacade }, { type: undefined, decorators: [{
|
|
144
|
+
}], ctorParameters: function () { return [{ type: i1$1.DaffAuthFacade }, { type: undefined, decorators: [{
|
|
121
145
|
type: Inject,
|
|
122
146
|
args: [DAFF_AUTH_ROUTING_CONFIG]
|
|
123
147
|
}] }]; } });
|
|
@@ -161,19 +185,27 @@ class DaffAuthRedirectEffects {
|
|
|
161
185
|
this.actions$ = actions$;
|
|
162
186
|
this.router = router;
|
|
163
187
|
this.config = config;
|
|
164
|
-
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(
|
|
188
|
+
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction, DaffAuthRegisterActionTypes.RegisterSuccessAction, DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction), filter((action) => {
|
|
189
|
+
if ((action.type === DaffAuthRegisterActionTypes.RegisterSuccessAction || action.type === DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction) && !action.token) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
}), tap(() => {
|
|
165
194
|
this.router.navigateByUrl(this.config.authCompleteRedirectPath);
|
|
166
195
|
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
167
|
-
this.redirectAfterLogout$ = createEffect(() => this.actions$.pipe(ofType(
|
|
196
|
+
this.redirectAfterLogout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
168
197
|
this.router.navigateByUrl(this.config.logoutRedirectPath);
|
|
169
198
|
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
199
|
+
this.redirectAfterExpiration$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction, DaffAuthActionTypes.AuthGuardLogoutAction), tap(() => {
|
|
200
|
+
this.router.navigateByUrl(this.config.tokenExpirationRedirectPath);
|
|
201
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
170
202
|
}
|
|
171
203
|
}
|
|
172
|
-
/** @nocollapse */ DaffAuthRedirectEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, deps: [{ token:
|
|
204
|
+
/** @nocollapse */ DaffAuthRedirectEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, deps: [{ token: i1$2.Actions }, { token: i3.Router }, { token: DAFF_AUTH_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
173
205
|
/** @nocollapse */ DaffAuthRedirectEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects });
|
|
174
206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, decorators: [{
|
|
175
207
|
type: Injectable
|
|
176
|
-
}], ctorParameters: function () { return [{ type:
|
|
208
|
+
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i3.Router }, { type: undefined, decorators: [{
|
|
177
209
|
type: Inject,
|
|
178
210
|
args: [DAFF_AUTH_ROUTING_CONFIG]
|
|
179
211
|
}] }]; } });
|
|
@@ -181,7 +213,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
181
213
|
class DaffAuthRoutingRedirectModule {
|
|
182
214
|
}
|
|
183
215
|
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
184
|
-
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [
|
|
216
|
+
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [i1$2.EffectsFeatureModule] });
|
|
185
217
|
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [[
|
|
186
218
|
EffectsModule.forFeature([
|
|
187
219
|
DaffAuthRedirectEffects,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-auth-routing.mjs","sources":["../../../libs/auth/routing/src/guards/member-only-guard-redirect.token.ts","../../../libs/auth/routing/src/guards/member-only.guard.ts","../../../libs/auth/routing/src/guards/guest-only-guard-redirect.token.ts","../../../libs/auth/routing/src/guards/guest-only.guard.ts","../../../libs/auth/routing/src/config/default.ts","../../../libs/auth/routing/src/config/token.ts","../../../libs/auth/routing/src/guards/reset-password.guard.ts","../../../libs/auth/routing/src/module.ts","../../../libs/auth/routing/src/effects/redirect.effects.ts","../../../libs/auth/routing/src/redirect.module.ts","../../../libs/auth/routing/src/daffodil-auth-routing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffAuthMemberOnlyGuardRedirectUrl = new InjectionToken<string>('DaffAuthMemberOnlyGuardRedirectUrl', { factory: () => '/' });\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Actions,\n ofType,\n} from '@ngrx/effects';\nimport { Observable } from 'rxjs';\nimport {\n map,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DaffAuthFacade,\n DaffAuthGuardCheck,\n DaffAuthActionTypes,\n DaffAuthGuardCheckCompletion,\n} from '@daffodil/auth/state';\n\nimport { DaffAuthMemberOnlyGuardRedirectUrl } from './member-only-guard-redirect.token';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class MemberOnlyGuard implements CanActivate {\n constructor(\n private facade: DaffAuthFacade,\n private actions$: Actions,\n private router: Router,\n @Inject(DaffAuthMemberOnlyGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n const ret = this.isAuthenticated().pipe(\n tap(result => {\n if (!result) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n\n this.facade.dispatch(new DaffAuthGuardCheck());\n\n return ret;\n }\n\n private isAuthenticated(): Observable<boolean> {\n return this.actions$.pipe(\n ofType(DaffAuthActionTypes.AuthGuardCheckCompletionAction),\n map((action: DaffAuthGuardCheckCompletion) => action.result),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffAuthGuestOnlyGuardRedirectUrl = new InjectionToken<string>('DaffAuthGuestOnlyGuardRedirectUrl', { factory: () => '/' });\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Actions,\n ofType,\n} from '@ngrx/effects';\nimport { Observable } from 'rxjs';\nimport {\n map,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DaffAuthActionTypes,\n DaffAuthFacade,\n DaffAuthGuardCheck,\n DaffAuthGuardCheckCompletion,\n} from '@daffodil/auth/state';\n\nimport { DaffAuthGuestOnlyGuardRedirectUrl } from './guest-only-guard-redirect.token';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class GuestOnlyGuard implements CanActivate {\n constructor(\n private facade: DaffAuthFacade,\n private actions$: Actions,\n private router: Router,\n @Inject(DaffAuthGuestOnlyGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n const ret = this.isUnauthenticated().pipe(\n tap(result => {\n if (!result) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n\n this.facade.dispatch(new DaffAuthGuardCheck());\n\n return ret;\n }\n\n private isUnauthenticated(): Observable<boolean> {\n return this.actions$.pipe(\n ofType(DaffAuthActionTypes.AuthGuardCheckCompletionAction),\n map((action: DaffAuthGuardCheckCompletion) => !action.result),\n );\n }\n}\n","import { DaffAuthRoutingConfig } from './interface';\n\nexport const DAFF_AUTH_ROUTING_CONFIG_DEFAULT: DaffAuthRoutingConfig = {\n resetPasswordTokenParam: 'token',\n authCompleteRedirectPath: '/',\n logoutRedirectPath: '/',\n};\n","import {\n InjectionToken,\n ValueProvider,\n} from '@angular/core';\n\nimport { DAFF_AUTH_ROUTING_CONFIG_DEFAULT } from './default';\nimport { DaffAuthRoutingConfig } from './interface';\n\n/**\n * The token used to provide @daffodil/auth/routing config data.\n */\nexport const DAFF_AUTH_ROUTING_CONFIG = new InjectionToken<DaffAuthRoutingConfig>('DAFF_AUTH_ROUTING_CONFIG', {\n factory: () => DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n});\n\nexport const provideDaffAuthRoutingConfig = (config: Partial<DaffAuthRoutingConfig>): ValueProvider => ({\n provide: DAFF_AUTH_ROUTING_CONFIG,\n useValue: {\n ...DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n ...config,\n },\n});\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffAuthFacade,\n DaffResetPasswordLanding,\n} from '@daffodil/auth/state';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n} from '../config/public_api';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class DaffAuthResetPasswordGuard implements CanActivate {\n constructor(\n private facade: DaffAuthFacade,\n @Inject(DAFF_AUTH_ROUTING_CONFIG) private config: DaffAuthRoutingConfig,\n ) {}\n\n canActivate(route: ActivatedRouteSnapshot): Observable<boolean> {\n const token = route.queryParamMap.get(this.config.resetPasswordTokenParam);\n\n if (!token) {\n return of(false);\n }\n\n this.facade.dispatch(new DaffResetPasswordLanding(token));\n\n return of(true);\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n} from './config/public_api';\nimport {\n DaffAuthResetPasswordGuard,\n GuestOnlyGuard,\n MemberOnlyGuard,\n} from './guards/public_api';\n\n@NgModule({\n providers: [\n DaffAuthResetPasswordGuard,\n MemberOnlyGuard,\n GuestOnlyGuard,\n ],\n})\nexport class DaffAuthRoutingModule {\n static withConfig(config?: Partial<DaffAuthRoutingConfig>): ModuleWithProviders<DaffAuthRoutingModule> {\n return {\n ngModule: DaffAuthRoutingModule,\n providers: [\n {\n provide: DAFF_AUTH_ROUTING_CONFIG,\n useValue: config || DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n },\n ],\n };\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport { EMPTY } from 'rxjs';\nimport {\n switchMap,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DaffAuthActionTypes,\n DaffAuthComplete,\n DaffAuthLoginActionTypes,\n} from '@daffodil/auth/state';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n} from '../config/public_api';\n\n/**\n * Redirects the user to certain pages based on certain auth actions.\n */\n@Injectable()\nexport class DaffAuthRedirectEffects {\n constructor(\n private actions$: Actions,\n private router: Router,\n @Inject(DAFF_AUTH_ROUTING_CONFIG) private config: DaffAuthRoutingConfig,\n ) {}\n\n redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(\n ofType<DaffAuthComplete>(DaffAuthActionTypes.AuthCompleteAction),\n tap(() => {\n this.router.navigateByUrl(this.config.authCompleteRedirectPath);\n }),\n switchMap(() => EMPTY),\n ), { dispatch: false });\n\n redirectAfterLogout$ = createEffect(() => this.actions$.pipe(\n ofType(DaffAuthActionTypes.AuthRevokeAction),\n tap(() => {\n this.router.navigateByUrl(this.config.logoutRedirectPath);\n }),\n switchMap(() => EMPTY),\n ), { dispatch: false });\n}\n","import { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\n\nimport { DaffAuthRedirectEffects } from './effects/redirect.effects';\n\n@NgModule({\n imports: [\n EffectsModule.forFeature([\n DaffAuthRedirectEffects,\n ]),\n ],\n})\nexport class DaffAuthRoutingRedirectModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;AAEa,MAAA,kCAAkC,GAAG,IAAI,cAAc,CAAS,oCAAoC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,EAAE;;MC4B5H,eAAe,CAAA;AAC1B,IAAA,WAAA,CACU,MAAsB,EACtB,QAAiB,EACjB,MAAc,EAC8B,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daffodil-auth-routing.mjs","sources":["../../../libs/auth/routing/src/guards/member-only-guard-redirect.token.ts","../../../libs/auth/routing/src/guards/member-only.guard.ts","../../../libs/auth/routing/src/guards/guest-only-guard-redirect.token.ts","../../../libs/auth/routing/src/guards/guest-only.guard.ts","../../../libs/auth/routing/src/config/default.ts","../../../libs/auth/routing/src/config/token.ts","../../../libs/auth/routing/src/guards/reset-password.guard.ts","../../../libs/auth/routing/src/module.ts","../../../libs/auth/routing/src/effects/redirect.effects.ts","../../../libs/auth/routing/src/redirect.module.ts","../../../libs/auth/routing/src/daffodil-auth-routing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffAuthMemberOnlyGuardRedirectUrl = new InjectionToken<string>('DaffAuthMemberOnlyGuardRedirectUrl', { factory: () => '/' });\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Store } from '@ngrx/store';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DAFF_AUTH_ERROR_MATCHER,\n DaffAuthStorageService,\n} from '@daffodil/auth';\nimport {\n DaffAuthDriverErrorCodes,\n DaffAuthDriverTokenCheck,\n} from '@daffodil/auth/driver';\nimport { DaffAuthGuardLogout } from '@daffodil/auth/state';\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\n\nimport { DaffAuthMemberOnlyGuardRedirectUrl } from './member-only-guard-redirect.token';\n\n\n@Injectable({\n providedIn: 'any',\n})\nexport class MemberOnlyGuard implements CanActivate {\n constructor(\n private tokenCheck: DaffAuthDriverTokenCheck,\n private storage: DaffAuthStorageService,\n private router: Router,\n private store: Store,\n @Inject(DAFF_AUTH_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n @Inject(DaffAuthMemberOnlyGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.isAuthenticated().pipe(\n tap(result => {\n if (!result) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n\n private isAuthenticated(): Observable<boolean> {\n return this.tokenCheck.check().pipe(\n map(() => true),\n catchError((error: DaffError) => {\n if (error.code === DaffAuthDriverErrorCodes.UNAUTHORIZED) {\n this.storage.removeAuthToken();\n this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));\n }\n return of(false);\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffAuthGuestOnlyGuardRedirectUrl = new InjectionToken<string>('DaffAuthGuestOnlyGuardRedirectUrl', { factory: () => '/' });\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Store } from '@ngrx/store';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DAFF_AUTH_ERROR_MATCHER,\n DaffAuthStorageService,\n} from '@daffodil/auth';\nimport {\n DaffAuthDriverErrorCodes,\n DaffAuthDriverTokenCheck,\n} from '@daffodil/auth/driver';\nimport { DaffAuthGuardLogout } from '@daffodil/auth/state';\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\n\nimport { DaffAuthGuestOnlyGuardRedirectUrl } from './guest-only-guard-redirect.token';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class GuestOnlyGuard implements CanActivate {\n constructor(\n private tokenCheck: DaffAuthDriverTokenCheck,\n private storage: DaffAuthStorageService,\n private router: Router,\n private store: Store,\n @Inject(DAFF_AUTH_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n @Inject(DaffAuthGuestOnlyGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.isUnauthenticated().pipe(\n tap(result => {\n if (!result) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n\n private isUnauthenticated(): Observable<boolean> {\n return this.tokenCheck.check().pipe(\n map(() => false),\n catchError((error: DaffError) => {\n if (error.code === DaffAuthDriverErrorCodes.UNAUTHORIZED) {\n this.storage.removeAuthToken();\n this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));\n }\n return of(true);\n }),\n );\n }\n}\n","import { DaffAuthRoutingConfig } from './interface';\n\nexport const DAFF_AUTH_ROUTING_CONFIG_DEFAULT: DaffAuthRoutingConfig = {\n resetPasswordTokenParam: 'token',\n authCompleteRedirectPath: '/',\n logoutRedirectPath: '/',\n tokenExpirationRedirectPath: '/',\n};\n","import {\n InjectionToken,\n ValueProvider,\n} from '@angular/core';\n\nimport { DAFF_AUTH_ROUTING_CONFIG_DEFAULT } from './default';\nimport { DaffAuthRoutingConfig } from './interface';\n\n/**\n * The token used to provide @daffodil/auth/routing config data.\n */\nexport const DAFF_AUTH_ROUTING_CONFIG = new InjectionToken<DaffAuthRoutingConfig>('DAFF_AUTH_ROUTING_CONFIG', {\n factory: () => DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n});\n\nexport const provideDaffAuthRoutingConfig = (config: Partial<DaffAuthRoutingConfig>): ValueProvider => ({\n provide: DAFF_AUTH_ROUTING_CONFIG,\n useValue: {\n ...DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n ...config,\n },\n});\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffAuthFacade,\n DaffResetPasswordLanding,\n} from '@daffodil/auth/state';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n} from '../config/public_api';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class DaffAuthResetPasswordGuard implements CanActivate {\n constructor(\n private facade: DaffAuthFacade,\n @Inject(DAFF_AUTH_ROUTING_CONFIG) private config: DaffAuthRoutingConfig,\n ) {}\n\n canActivate(route: ActivatedRouteSnapshot): Observable<boolean> {\n const token = route.queryParamMap.get(this.config.resetPasswordTokenParam);\n\n if (!token) {\n return of(false);\n }\n\n this.facade.dispatch(new DaffResetPasswordLanding(token));\n\n return of(true);\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n} from './config/public_api';\nimport {\n DaffAuthResetPasswordGuard,\n GuestOnlyGuard,\n MemberOnlyGuard,\n} from './guards/public_api';\n\n@NgModule({\n providers: [\n DaffAuthResetPasswordGuard,\n MemberOnlyGuard,\n GuestOnlyGuard,\n ],\n})\nexport class DaffAuthRoutingModule {\n static withConfig(config?: Partial<DaffAuthRoutingConfig>): ModuleWithProviders<DaffAuthRoutingModule> {\n return {\n ngModule: DaffAuthRoutingModule,\n providers: [\n {\n provide: DAFF_AUTH_ROUTING_CONFIG,\n useValue: config || DAFF_AUTH_ROUTING_CONFIG_DEFAULT,\n },\n ],\n };\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport { EMPTY } from 'rxjs';\nimport {\n filter,\n switchMap,\n tap,\n} from 'rxjs/operators';\n\nimport {\n DaffAuthActionTypes,\n DaffAuthActions,\n DaffAuthLoginActionTypes,\n DaffAuthLoginActions,\n DaffAuthRegisterActionTypes,\n DaffAuthRegisterActions,\n DaffAuthResetPasswordActionTypes,\n DaffAuthResetPasswordActions,\n} from '@daffodil/auth/state';\n\nimport {\n DaffAuthRoutingConfig,\n DAFF_AUTH_ROUTING_CONFIG,\n} from '../config/public_api';\n\n/**\n * Redirects the user to certain pages based on certain auth actions.\n */\n@Injectable()\nexport class DaffAuthRedirectEffects {\n constructor(\n private actions$: Actions<DaffAuthLoginActions | DaffAuthActions | DaffAuthRegisterActions | DaffAuthResetPasswordActions>,\n private router: Router,\n @Inject(DAFF_AUTH_ROUTING_CONFIG) private config: DaffAuthRoutingConfig,\n ) {}\n\n redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(\n ofType(\n DaffAuthLoginActionTypes.LoginSuccessAction,\n DaffAuthRegisterActionTypes.RegisterSuccessAction,\n DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction,\n ),\n filter((action) => {\n if ((action.type === DaffAuthRegisterActionTypes.RegisterSuccessAction || action.type === DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction) && !action.token) {\n return false;\n }\n return true;\n }),\n tap(() => {\n this.router.navigateByUrl(this.config.authCompleteRedirectPath);\n }),\n switchMap(() => EMPTY),\n ), { dispatch: false });\n\n redirectAfterLogout$ = createEffect(() => this.actions$.pipe(\n ofType(DaffAuthLoginActionTypes.LogoutSuccessAction),\n tap(() => {\n this.router.navigateByUrl(this.config.logoutRedirectPath);\n }),\n switchMap(() => EMPTY),\n ), { dispatch: false });\n\n redirectAfterExpiration$ = createEffect(() => this.actions$.pipe(\n ofType(\n DaffAuthActionTypes.AuthCheckFailureAction,\n DaffAuthActionTypes.AuthGuardLogoutAction,\n ),\n tap(() => {\n this.router.navigateByUrl(this.config.tokenExpirationRedirectPath);\n }),\n switchMap(() => EMPTY),\n ), { dispatch: false });\n}\n","import { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\n\nimport { DaffAuthRedirectEffects } from './effects/redirect.effects';\n\n@NgModule({\n imports: [\n EffectsModule.forFeature([\n DaffAuthRedirectEffects,\n ]),\n ],\n})\nexport class DaffAuthRoutingRedirectModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;AAEa,MAAA,kCAAkC,GAAG,IAAI,cAAc,CAAS,oCAAoC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,EAAE;;MCmC5H,eAAe,CAAA;IAC1B,WACU,CAAA,UAAoC,EACpC,OAA+B,EAC/B,M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,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,EAN/B,OAAA,EAAA,CAAA;YACP,aAAa,CAAC,UAAU,CAAC;gBACvB,uBAAuB;aACxB,CAAC;AACH,SAAA,CAAA,EAAA,CAAA,CAAA;2FAEU,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAPzC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,aAAa,CAAC,UAAU,CAAC;4BACvB,uBAAuB;yBACxB,CAAC;AACH,qBAAA;AACF,iBAAA,CAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -5,41 +5,23 @@ import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
|
|
|
5
5
|
import * as i1$1 from '@ngrx/effects';
|
|
6
6
|
import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
|
7
7
|
import { of, EMPTY, iif, defer } from 'rxjs';
|
|
8
|
-
import { switchMap, map, catchError,
|
|
9
|
-
import * as i2 from '@daffodil/auth';
|
|
8
|
+
import { switchMap, map, catchError, tap, repeat, filter } from 'rxjs/operators';
|
|
9
|
+
import * as i2$1 from '@daffodil/auth';
|
|
10
10
|
import { DAFF_AUTH_ERROR_MATCHER } from '@daffodil/auth';
|
|
11
|
-
import
|
|
11
|
+
import * as i2 from '@daffodil/auth/driver';
|
|
12
|
+
import { DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from '@daffodil/auth/driver';
|
|
12
13
|
import { DaffStorageServiceError, DaffServerSideStorageError } from '@daffodil/core';
|
|
14
|
+
import { DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE } from '@daffodil/driver';
|
|
13
15
|
|
|
14
16
|
var DaffAuthActionTypes;
|
|
15
17
|
(function (DaffAuthActionTypes) {
|
|
16
|
-
DaffAuthActionTypes["AuthGuardCheckAction"] = "[@daffodil/auth] Auth Guard Check Action";
|
|
17
|
-
DaffAuthActionTypes["AuthGuardCheckCompletionAction"] = "[@daffodil/auth] Auth Guard Check Completion Action";
|
|
18
18
|
DaffAuthActionTypes["AuthStorageFailureAction"] = "[@daffodil/auth] Auth Storage Failure Action";
|
|
19
|
+
DaffAuthActionTypes["AuthGuardLogoutAction"] = "[@daffodil/auth] Auth Guard Logout Action";
|
|
19
20
|
DaffAuthActionTypes["AuthServerSideAction"] = "[@daffodil/auth] Auth Server Side Action";
|
|
20
21
|
DaffAuthActionTypes["AuthCheckAction"] = "[@daffodil/auth] Auth Check Action";
|
|
21
22
|
DaffAuthActionTypes["AuthCheckSuccessAction"] = "[@daffodil/auth] Auth Check Success Action";
|
|
22
23
|
DaffAuthActionTypes["AuthCheckFailureAction"] = "[@daffodil/auth] Auth Check Failure Action";
|
|
23
|
-
DaffAuthActionTypes["AuthCompleteAction"] = "[@daffodil/auth] Auth Complete Action";
|
|
24
|
-
DaffAuthActionTypes["AuthRevokeAction"] = "[@daffodil/auth] Auth Revoke Action";
|
|
25
24
|
})(DaffAuthActionTypes || (DaffAuthActionTypes = {}));
|
|
26
|
-
/**
|
|
27
|
-
* An action triggered by guards to initialize an auth check request.
|
|
28
|
-
*/
|
|
29
|
-
class DaffAuthGuardCheck {
|
|
30
|
-
constructor() {
|
|
31
|
-
this.type = DaffAuthActionTypes.AuthGuardCheckAction;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* An action triggered on the completion of a guard token check.
|
|
36
|
-
*/
|
|
37
|
-
class DaffAuthGuardCheckCompletion {
|
|
38
|
-
constructor(result) {
|
|
39
|
-
this.result = result;
|
|
40
|
-
this.type = DaffAuthActionTypes.AuthGuardCheckCompletionAction;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
25
|
/*
|
|
44
26
|
* An action triggered upon a failed auth storage operation.
|
|
45
27
|
*/
|
|
@@ -49,6 +31,15 @@ class DaffAuthStorageFailure {
|
|
|
49
31
|
this.type = DaffAuthActionTypes.AuthStorageFailureAction;
|
|
50
32
|
}
|
|
51
33
|
}
|
|
34
|
+
/*
|
|
35
|
+
* An action triggered when an auth token is cleared from storage by a routing guard.
|
|
36
|
+
*/
|
|
37
|
+
class DaffAuthGuardLogout {
|
|
38
|
+
constructor(errorMessage) {
|
|
39
|
+
this.errorMessage = errorMessage;
|
|
40
|
+
this.type = DaffAuthActionTypes.AuthGuardLogoutAction;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
52
43
|
/*
|
|
53
44
|
* An action triggered when an invalid operation is performed in the server environment.
|
|
54
45
|
* A common example is trying to access the auth token from storage.
|
|
@@ -88,24 +79,6 @@ class DaffAuthCheckFailure {
|
|
|
88
79
|
this.type = DaffAuthActionTypes.AuthCheckFailureAction;
|
|
89
80
|
}
|
|
90
81
|
}
|
|
91
|
-
/**
|
|
92
|
-
* An action triggered when the user authentication flow is completed.
|
|
93
|
-
* The auth token is in storage at this point.
|
|
94
|
-
*/
|
|
95
|
-
class DaffAuthComplete {
|
|
96
|
-
constructor() {
|
|
97
|
-
this.type = DaffAuthActionTypes.AuthCompleteAction;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* An action triggered when the user auth token is revoked.
|
|
102
|
-
* The auth token has been removed from storage at this point.
|
|
103
|
-
*/
|
|
104
|
-
class DaffAuthRevoke {
|
|
105
|
-
constructor() {
|
|
106
|
-
this.type = DaffAuthActionTypes.AuthRevokeAction;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
82
|
|
|
110
83
|
var DaffAuthLoginActionTypes;
|
|
111
84
|
(function (DaffAuthLoginActionTypes) {
|
|
@@ -270,7 +243,8 @@ class DaffResetPassword {
|
|
|
270
243
|
* An action triggered upon a successful logout.
|
|
271
244
|
*/
|
|
272
245
|
class DaffResetPasswordSuccess {
|
|
273
|
-
constructor() {
|
|
246
|
+
constructor(token) {
|
|
247
|
+
this.token = token;
|
|
274
248
|
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction;
|
|
275
249
|
}
|
|
276
250
|
}
|
|
@@ -318,6 +292,7 @@ function daffAuthReducer(state = daffAuthInitialState, action) {
|
|
|
318
292
|
errors: [],
|
|
319
293
|
};
|
|
320
294
|
case DaffAuthActionTypes.AuthCheckFailureAction:
|
|
295
|
+
case DaffAuthActionTypes.AuthGuardLogoutAction:
|
|
321
296
|
return {
|
|
322
297
|
...state,
|
|
323
298
|
loggedIn: false,
|
|
@@ -331,12 +306,18 @@ function daffAuthReducer(state = daffAuthInitialState, action) {
|
|
|
331
306
|
loading: false,
|
|
332
307
|
errors: [action.errorMessage],
|
|
333
308
|
};
|
|
334
|
-
case
|
|
309
|
+
case DaffAuthLoginActionTypes.LoginSuccessAction:
|
|
335
310
|
return {
|
|
336
311
|
...state,
|
|
337
312
|
loggedIn: true,
|
|
338
313
|
};
|
|
339
|
-
case
|
|
314
|
+
case DaffAuthRegisterActionTypes.RegisterSuccessAction:
|
|
315
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction:
|
|
316
|
+
return action.token ? {
|
|
317
|
+
...state,
|
|
318
|
+
loggedIn: true,
|
|
319
|
+
} : state;
|
|
320
|
+
case DaffAuthLoginActionTypes.LogoutSuccessAction:
|
|
340
321
|
return {
|
|
341
322
|
...state,
|
|
342
323
|
loggedIn: false,
|
|
@@ -643,23 +624,17 @@ const provideDaffAuthStateConfig = (config) => ({
|
|
|
643
624
|
});
|
|
644
625
|
|
|
645
626
|
class DaffAuthEffects {
|
|
646
|
-
constructor(actions$,
|
|
627
|
+
constructor(actions$, tokenCheck, errorMatcher, storage, config, clientCache) {
|
|
647
628
|
this.actions$ = actions$;
|
|
648
|
-
this.
|
|
629
|
+
this.tokenCheck = tokenCheck;
|
|
649
630
|
this.errorMatcher = errorMatcher;
|
|
650
631
|
this.storage = storage;
|
|
651
632
|
this.config = config;
|
|
652
|
-
this.
|
|
653
|
-
this.
|
|
654
|
-
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.
|
|
655
|
-
// don't remove token when guard check completes with true result
|
|
656
|
-
if (action.type === DaffAuthActionTypes.AuthGuardCheckCompletionAction && action.result) {
|
|
657
|
-
return false;
|
|
658
|
-
}
|
|
659
|
-
return true;
|
|
660
|
-
}), tap(() => {
|
|
633
|
+
this.clientCache = clientCache;
|
|
634
|
+
this.check$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckAction), switchMap((action) => this.tokenCheck.check().pipe(map(() => new DaffAuthCheckSuccess()), catchError((error) => of(new DaffAuthCheckFailure(this.errorMatcher(error))))))));
|
|
635
|
+
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction), tap(() => {
|
|
661
636
|
this.storage.removeAuthToken();
|
|
662
|
-
}),
|
|
637
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
663
638
|
switch (true) {
|
|
664
639
|
case error instanceof DaffServerSideStorageError:
|
|
665
640
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -667,7 +642,7 @@ class DaffAuthEffects {
|
|
|
667
642
|
default:
|
|
668
643
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
669
644
|
}
|
|
670
|
-
})));
|
|
645
|
+
})), { dispatch: false });
|
|
671
646
|
// this needs to be defined after `check$` or else the driver call won't be run
|
|
672
647
|
this.authCheckInterval$ = createEffect(() => of(new DaffAuthCheck()).pipe(repeat({ delay: this.config.checkInterval }), filter(() => !!this.storage.getAuthToken()), catchError((error) => {
|
|
673
648
|
switch (true) {
|
|
@@ -679,21 +654,24 @@ class DaffAuthEffects {
|
|
|
679
654
|
return EMPTY;
|
|
680
655
|
}
|
|
681
656
|
})));
|
|
657
|
+
this.clearClientCache$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction, DaffAuthActionTypes.AuthGuardLogoutAction, DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
658
|
+
this.clientCache.reset();
|
|
659
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
682
660
|
}
|
|
683
661
|
}
|
|
684
|
-
/** @nocollapse */ DaffAuthEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, deps: [{ token: i1$1.Actions }, { token:
|
|
662
|
+
/** @nocollapse */ DaffAuthEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, deps: [{ token: i1$1.Actions }, { token: i2.DaffAuthDriverTokenCheck }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }, { token: DAFF_AUTH_STATE_CONFIG }, { token: DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
685
663
|
/** @nocollapse */ DaffAuthEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects });
|
|
686
664
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, decorators: [{
|
|
687
665
|
type: Injectable
|
|
688
|
-
}], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
689
|
-
type: Inject,
|
|
690
|
-
args: [DaffAuthDriver]
|
|
691
|
-
}] }, { type: undefined, decorators: [{
|
|
666
|
+
}], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: i2.DaffAuthDriverTokenCheck }, { type: undefined, decorators: [{
|
|
692
667
|
type: Inject,
|
|
693
668
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
694
|
-
}] }, { type: i2.DaffAuthStorageService }, { type: undefined, decorators: [{
|
|
669
|
+
}] }, { type: i2$1.DaffAuthStorageService }, { type: undefined, decorators: [{
|
|
695
670
|
type: Inject,
|
|
696
671
|
args: [DAFF_AUTH_STATE_CONFIG]
|
|
672
|
+
}] }, { type: undefined, decorators: [{
|
|
673
|
+
type: Inject,
|
|
674
|
+
args: [DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE]
|
|
697
675
|
}] }]; } });
|
|
698
676
|
|
|
699
677
|
class DaffAuthLoginEffects {
|
|
@@ -706,7 +684,7 @@ class DaffAuthLoginEffects {
|
|
|
706
684
|
this.logout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutAction), switchMap((action) => this.loginDriver.logout().pipe(map(() => new DaffAuthLogoutSuccess()), catchError((error) => of(new DaffAuthLogoutFailure(this.errorMatcher(error))))))));
|
|
707
685
|
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
708
686
|
this.storage.removeAuthToken();
|
|
709
|
-
}),
|
|
687
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
710
688
|
switch (true) {
|
|
711
689
|
case error instanceof DaffServerSideStorageError:
|
|
712
690
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -714,10 +692,10 @@ class DaffAuthLoginEffects {
|
|
|
714
692
|
default:
|
|
715
693
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
716
694
|
}
|
|
717
|
-
})));
|
|
695
|
+
})), { dispatch: false });
|
|
718
696
|
this.storeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction), tap((action) => {
|
|
719
697
|
this.storage.setAuthToken(action.auth.token);
|
|
720
|
-
}),
|
|
698
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
721
699
|
switch (true) {
|
|
722
700
|
case error instanceof DaffServerSideStorageError:
|
|
723
701
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -725,10 +703,10 @@ class DaffAuthLoginEffects {
|
|
|
725
703
|
default:
|
|
726
704
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
727
705
|
}
|
|
728
|
-
})));
|
|
706
|
+
})), { dispatch: false });
|
|
729
707
|
}
|
|
730
708
|
}
|
|
731
|
-
/** @nocollapse */ DaffAuthLoginEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, deps: [{ token: i1$1.Actions }, { token: DaffLoginDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
709
|
+
/** @nocollapse */ DaffAuthLoginEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, deps: [{ token: i1$1.Actions }, { token: DaffLoginDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
732
710
|
/** @nocollapse */ DaffAuthLoginEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects });
|
|
733
711
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, decorators: [{
|
|
734
712
|
type: Injectable
|
|
@@ -738,7 +716,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
738
716
|
}] }, { type: undefined, decorators: [{
|
|
739
717
|
type: Inject,
|
|
740
718
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
741
|
-
}] }, { type: i2.DaffAuthStorageService }]; } });
|
|
719
|
+
}] }, { type: i2$1.DaffAuthStorageService }]; } });
|
|
742
720
|
|
|
743
721
|
class DaffAuthRegisterEffects {
|
|
744
722
|
constructor(actions$, registerDriver, errorMatcher, storage) {
|
|
@@ -746,7 +724,7 @@ class DaffAuthRegisterEffects {
|
|
|
746
724
|
this.registerDriver = registerDriver;
|
|
747
725
|
this.errorMatcher = errorMatcher;
|
|
748
726
|
this.storage = storage;
|
|
749
|
-
this.register$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthRegisterActionTypes.RegisterAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.registerDriver.register(action.registration).pipe(tap(token => this.storage.setAuthToken(token)),
|
|
727
|
+
this.register$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthRegisterActionTypes.RegisterAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.registerDriver.register(action.registration).pipe(tap(token => this.storage.setAuthToken(token)), map((token) => new DaffAuthRegisterSuccess(token)))), defer(() => this.registerDriver.registerOnly(action.registration).pipe(map(() => new DaffAuthRegisterSuccess())))).pipe(catchError((error) => {
|
|
750
728
|
switch (true) {
|
|
751
729
|
case error instanceof DaffServerSideStorageError:
|
|
752
730
|
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
@@ -758,7 +736,7 @@ class DaffAuthRegisterEffects {
|
|
|
758
736
|
})))));
|
|
759
737
|
}
|
|
760
738
|
}
|
|
761
|
-
/** @nocollapse */ DaffAuthRegisterEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, deps: [{ token: i1$1.Actions }, { token: DaffRegisterDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
739
|
+
/** @nocollapse */ DaffAuthRegisterEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, deps: [{ token: i1$1.Actions }, { token: DaffRegisterDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
762
740
|
/** @nocollapse */ DaffAuthRegisterEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects });
|
|
763
741
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, decorators: [{
|
|
764
742
|
type: Injectable
|
|
@@ -768,7 +746,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
768
746
|
}] }, { type: undefined, decorators: [{
|
|
769
747
|
type: Inject,
|
|
770
748
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
771
|
-
}] }, { type: i2.DaffAuthStorageService }]; } });
|
|
749
|
+
}] }, { type: i2$1.DaffAuthStorageService }]; } });
|
|
772
750
|
|
|
773
751
|
class DaffAuthResetPasswordEffects {
|
|
774
752
|
constructor(actions$, driver, errorMatcher, storage) {
|
|
@@ -777,7 +755,7 @@ class DaffAuthResetPasswordEffects {
|
|
|
777
755
|
this.errorMatcher = errorMatcher;
|
|
778
756
|
this.storage = storage;
|
|
779
757
|
this.sendResetEmail$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.SendResetEmailAction), switchMap((action) => this.driver.sendResetEmail(action.email).pipe(map(() => new DaffSendResetEmailSuccess()), catchError((error) => of(new DaffSendResetEmailFailure(this.errorMatcher(error))))))));
|
|
780
|
-
this.resetPassword$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.ResetPasswordAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.driver.resetPassword(action.info).pipe(tap(token => this.storage.setAuthToken(token)),
|
|
758
|
+
this.resetPassword$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.ResetPasswordAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.driver.resetPassword(action.info).pipe(tap(token => this.storage.setAuthToken(token)), map((token) => new DaffResetPasswordSuccess(token)))), defer(() => this.driver.resetPasswordOnly(action.info).pipe(map(() => new DaffResetPasswordSuccess())))).pipe(catchError((error) => {
|
|
781
759
|
switch (true) {
|
|
782
760
|
case error instanceof DaffServerSideStorageError:
|
|
783
761
|
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
@@ -789,7 +767,7 @@ class DaffAuthResetPasswordEffects {
|
|
|
789
767
|
})))));
|
|
790
768
|
}
|
|
791
769
|
}
|
|
792
|
-
/** @nocollapse */ DaffAuthResetPasswordEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, deps: [{ token: i1$1.Actions }, { token: DaffResetPasswordDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
770
|
+
/** @nocollapse */ DaffAuthResetPasswordEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, deps: [{ token: i1$1.Actions }, { token: DaffResetPasswordDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
793
771
|
/** @nocollapse */ DaffAuthResetPasswordEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects });
|
|
794
772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, decorators: [{
|
|
795
773
|
type: Injectable
|
|
@@ -799,7 +777,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
799
777
|
}] }, { type: undefined, decorators: [{
|
|
800
778
|
type: Inject,
|
|
801
779
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
802
|
-
}] }, { type: i2.DaffAuthStorageService }]; } });
|
|
780
|
+
}] }, { type: i2$1.DaffAuthStorageService }]; } });
|
|
803
781
|
|
|
804
782
|
class DaffAuthStateModule {
|
|
805
783
|
static withConfig(config = {}) {
|
|
@@ -844,5 +822,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
844
822
|
* Generated bundle index. Do not edit.
|
|
845
823
|
*/
|
|
846
824
|
|
|
847
|
-
export { DAFF_AUTH_STATE_CONFIG, DAFF_AUTH_STORE_FEATURE_KEY, DaffAuthActionTypes, DaffAuthCheck, DaffAuthCheckFailure, DaffAuthCheckSuccess,
|
|
825
|
+
export { DAFF_AUTH_STATE_CONFIG, DAFF_AUTH_STORE_FEATURE_KEY, DaffAuthActionTypes, DaffAuthCheck, DaffAuthCheckFailure, DaffAuthCheckSuccess, DaffAuthFacade, DaffAuthGuardLogout, DaffAuthLogin, DaffAuthLoginActionTypes, DaffAuthLoginFacade, DaffAuthLoginFailure, DaffAuthLoginSuccess, DaffAuthLogout, DaffAuthLogoutFailure, DaffAuthLogoutSuccess, DaffAuthRegister, DaffAuthRegisterActionTypes, DaffAuthRegisterFacade, DaffAuthRegisterFailure, DaffAuthRegisterSuccess, DaffAuthResetPasswordActionTypes, DaffAuthResetPasswordFacade, DaffAuthServerSide, DaffAuthStateModule, DaffAuthStorageFailure, DaffResetPassword, DaffResetPasswordFailure, DaffResetPasswordLanding, DaffResetPasswordSuccess, DaffSendResetEmail, DaffSendResetEmailFailure, DaffSendResetEmailSuccess, daffAuthInitialState, daffAuthLoginInitialState, daffAuthLoginReducer, daffAuthReducer, daffAuthReducers, daffAuthRegisterInitialState, daffAuthRegisterReducer, daffAuthResetPasswordInitialState, daffAuthResetPasswordReducer, daffAuthStateDefaultConfig, getDaffAuthSelectors, provideDaffAuthStateConfig };
|
|
848
826
|
//# sourceMappingURL=daffodil-auth-state.mjs.map
|