@daffodil/auth 0.57.0 → 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,36 +1,47 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
|
-
import * as i2 from '@ngrx/effects';
|
|
4
|
-
import { ofType, createEffect, EffectsModule } from '@ngrx/effects';
|
|
5
|
-
import { tap, map, switchMap } from 'rxjs/operators';
|
|
6
|
-
import * as i1 from '@daffodil/auth/state';
|
|
7
|
-
import { DaffAuthGuardCheck, DaffAuthActionTypes, DaffResetPasswordLanding } from '@daffodil/auth/state';
|
|
8
|
-
import * as i3 from '@angular/router';
|
|
9
3
|
import { of, EMPTY } from 'rxjs';
|
|
4
|
+
import { tap, map, catchError, filter, switchMap } from 'rxjs/operators';
|
|
5
|
+
import * as i2 from '@daffodil/auth';
|
|
6
|
+
import { DAFF_AUTH_ERROR_MATCHER } from '@daffodil/auth';
|
|
7
|
+
import * as i1 from '@daffodil/auth/driver';
|
|
8
|
+
import { DaffAuthDriverErrorCodes } from '@daffodil/auth/driver';
|
|
9
|
+
import * as i1$1 from '@daffodil/auth/state';
|
|
10
|
+
import { DaffAuthGuardLogout, DaffResetPasswordLanding, DaffAuthLoginActionTypes, DaffAuthRegisterActionTypes, DaffAuthResetPasswordActionTypes, DaffAuthActionTypes } from '@daffodil/auth/state';
|
|
11
|
+
import * as i3 from '@angular/router';
|
|
12
|
+
import * as i4 from '@ngrx/store';
|
|
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,
|
|
@@ -38,7 +49,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
38
49
|
providedIn: 'any',
|
|
39
50
|
}]
|
|
40
51
|
}], ctorParameters: function () {
|
|
41
|
-
return [{ type: i1.
|
|
52
|
+
return [{ type: i1.DaffAuthDriverTokenCheck }, { type: i2.DaffAuthStorageService }, { type: i3.Router }, { type: i4.Store }, { type: undefined, decorators: [{
|
|
53
|
+
type: Inject,
|
|
54
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
55
|
+
}] }, { type: undefined, decorators: [{
|
|
42
56
|
type: Inject,
|
|
43
57
|
args: [DaffAuthMemberOnlyGuardRedirectUrl]
|
|
44
58
|
}] }];
|
|
@@ -47,26 +61,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
47
61
|
const DaffAuthGuestOnlyGuardRedirectUrl = new InjectionToken('DaffAuthGuestOnlyGuardRedirectUrl', { factory: () => '/' });
|
|
48
62
|
|
|
49
63
|
class GuestOnlyGuard {
|
|
50
|
-
constructor(
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
64
|
+
constructor(tokenCheck, storage, router, store, errorMatcher, redirectUrl) {
|
|
65
|
+
this.tokenCheck = tokenCheck;
|
|
66
|
+
this.storage = storage;
|
|
53
67
|
this.router = router;
|
|
68
|
+
this.store = store;
|
|
69
|
+
this.errorMatcher = errorMatcher;
|
|
54
70
|
this.redirectUrl = redirectUrl;
|
|
55
71
|
}
|
|
56
72
|
canActivate() {
|
|
57
|
-
|
|
73
|
+
return this.isUnauthenticated().pipe(tap(result => {
|
|
58
74
|
if (!result) {
|
|
59
75
|
this.router.navigateByUrl(this.redirectUrl);
|
|
60
76
|
}
|
|
61
77
|
}));
|
|
62
|
-
this.facade.dispatch(new DaffAuthGuardCheck());
|
|
63
|
-
return ret;
|
|
64
78
|
}
|
|
65
79
|
isUnauthenticated() {
|
|
66
|
-
return this.
|
|
80
|
+
return this.tokenCheck.check().pipe(map(() => false), catchError((error) => {
|
|
81
|
+
if (error.code === DaffAuthDriverErrorCodes.UNAUTHORIZED) {
|
|
82
|
+
this.storage.removeAuthToken();
|
|
83
|
+
this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));
|
|
84
|
+
}
|
|
85
|
+
return of(true);
|
|
86
|
+
}));
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
|
-
/** @nocollapse */ GuestOnlyGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, deps: [{ token: i1.
|
|
89
|
+
/** @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 });
|
|
70
90
|
/** @nocollapse */ GuestOnlyGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, providedIn: 'any' });
|
|
71
91
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: GuestOnlyGuard, decorators: [{
|
|
72
92
|
type: Injectable,
|
|
@@ -74,7 +94,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
74
94
|
providedIn: 'any',
|
|
75
95
|
}]
|
|
76
96
|
}], ctorParameters: function () {
|
|
77
|
-
return [{ type: i1.
|
|
97
|
+
return [{ type: i1.DaffAuthDriverTokenCheck }, { type: i2.DaffAuthStorageService }, { type: i3.Router }, { type: i4.Store }, { type: undefined, decorators: [{
|
|
98
|
+
type: Inject,
|
|
99
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
100
|
+
}] }, { type: undefined, decorators: [{
|
|
78
101
|
type: Inject,
|
|
79
102
|
args: [DaffAuthGuestOnlyGuardRedirectUrl]
|
|
80
103
|
}] }];
|
|
@@ -84,6 +107,7 @@ const DAFF_AUTH_ROUTING_CONFIG_DEFAULT = {
|
|
|
84
107
|
resetPasswordTokenParam: 'token',
|
|
85
108
|
authCompleteRedirectPath: '/',
|
|
86
109
|
logoutRedirectPath: '/',
|
|
110
|
+
tokenExpirationRedirectPath: '/',
|
|
87
111
|
};
|
|
88
112
|
|
|
89
113
|
/**
|
|
@@ -111,7 +135,7 @@ class DaffAuthResetPasswordGuard {
|
|
|
111
135
|
return of(true);
|
|
112
136
|
}
|
|
113
137
|
}
|
|
114
|
-
/** @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 });
|
|
138
|
+
/** @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 });
|
|
115
139
|
/** @nocollapse */ DaffAuthResetPasswordGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, providedIn: 'any' });
|
|
116
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordGuard, decorators: [{
|
|
117
141
|
type: Injectable,
|
|
@@ -119,7 +143,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
119
143
|
providedIn: 'any',
|
|
120
144
|
}]
|
|
121
145
|
}], ctorParameters: function () {
|
|
122
|
-
return [{ type: i1.DaffAuthFacade }, { type: undefined, decorators: [{
|
|
146
|
+
return [{ type: i1$1.DaffAuthFacade }, { type: undefined, decorators: [{
|
|
123
147
|
type: Inject,
|
|
124
148
|
args: [DAFF_AUTH_ROUTING_CONFIG]
|
|
125
149
|
}] }];
|
|
@@ -164,20 +188,28 @@ class DaffAuthRedirectEffects {
|
|
|
164
188
|
this.actions$ = actions$;
|
|
165
189
|
this.router = router;
|
|
166
190
|
this.config = config;
|
|
167
|
-
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(
|
|
191
|
+
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction, DaffAuthRegisterActionTypes.RegisterSuccessAction, DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction), filter((action) => {
|
|
192
|
+
if ((action.type === DaffAuthRegisterActionTypes.RegisterSuccessAction || action.type === DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction) && !action.token) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
return true;
|
|
196
|
+
}), tap(() => {
|
|
168
197
|
this.router.navigateByUrl(this.config.authCompleteRedirectPath);
|
|
169
198
|
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
170
|
-
this.redirectAfterLogout$ = createEffect(() => this.actions$.pipe(ofType(
|
|
199
|
+
this.redirectAfterLogout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
171
200
|
this.router.navigateByUrl(this.config.logoutRedirectPath);
|
|
172
201
|
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
202
|
+
this.redirectAfterExpiration$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction, DaffAuthActionTypes.AuthGuardLogoutAction), tap(() => {
|
|
203
|
+
this.router.navigateByUrl(this.config.tokenExpirationRedirectPath);
|
|
204
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
173
205
|
}
|
|
174
206
|
}
|
|
175
|
-
/** @nocollapse */ DaffAuthRedirectEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, deps: [{ token:
|
|
207
|
+
/** @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 });
|
|
176
208
|
/** @nocollapse */ DaffAuthRedirectEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects });
|
|
177
209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, decorators: [{
|
|
178
210
|
type: Injectable
|
|
179
211
|
}], ctorParameters: function () {
|
|
180
|
-
return [{ type:
|
|
212
|
+
return [{ type: i1$2.Actions }, { type: i3.Router }, { type: undefined, decorators: [{
|
|
181
213
|
type: Inject,
|
|
182
214
|
args: [DAFF_AUTH_ROUTING_CONFIG]
|
|
183
215
|
}] }];
|
|
@@ -186,7 +218,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
186
218
|
class DaffAuthRoutingRedirectModule {
|
|
187
219
|
}
|
|
188
220
|
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
189
|
-
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [
|
|
221
|
+
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [i1$2.EffectsFeatureModule] });
|
|
190
222
|
/** @nocollapse */ DaffAuthRoutingRedirectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRoutingRedirectModule, imports: [[
|
|
191
223
|
EffectsModule.forFeature([
|
|
192
224
|
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 */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UAAU,CAAC;gBACvB,uBAAuB;aACxB,CAAC;SACH,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;iBACF,CAAA;;;ACXD;;AAEG;;;;"}
|
|
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 { 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,MAAc,EACd,KAAY,EACqB,YAA8B,EACnB,WAAmB,EAAA;AAL/D,QAAA,IAAU,CAAA,UAAA,GAAV,UAAU,CAA0B;AACpC,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAwB;AAC/B,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;AACd,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAO;AACqB,QAAA,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAkB;AACnB,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;KACrE;IAEJ,WAAW,GAAA;QACT,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAChC,GAAG,CAAC,MAAM,IAAG;YACX,IAAI,CAAC,MAAM,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC7C,aAAA;SACF,CAAC,CACH,CAAC;KACH;IAEO,eAAe,GAAA;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CACjC,GAAG,CAAC,MAAM,IAAI,CAAC,EACf,UAAU,CAAC,CAAC,KAAgB,KAAI;AAC9B,YAAA,IAAI,KAAK,CAAC,IAAI,KAAK,wBAAwB,CAAC,YAAY,EAAE;AACxD,gBAAA,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;AAC/B,gBAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,mB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AvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;;;8BAKN,MAAM;+BAAC,wBAAwB,CAAA;;;;MC7BvB,6BAA6B,CAAA;;6IAA7B,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;8IAA7B,6BAA6B,EAAA,OAAA,EAAA,CAAAA,IAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;AAA7B,mBAAA,6BAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,EAN/B,OAAA,EAAA,CAAA;YACP,aAAa,CAAC,UAAU,CAAC;gBACvB,uBAAuB;aACxB,CAAC;SACH,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;iBACF,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 { DaffAuthDriver, DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from '@daffodil/auth/driver';
|
|
12
11
|
import { DaffStorageServiceError, DaffServerSideStorageError } from '@daffodil/core';
|
|
12
|
+
import { DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE } from '@daffodil/driver';
|
|
13
|
+
import * as i2 from '@daffodil/auth/driver';
|
|
14
|
+
import { DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from '@daffodil/auth/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
|
}
|
|
@@ -310,13 +284,17 @@ function daffAuthReducer(state = daffAuthInitialState, action) {
|
|
|
310
284
|
case DaffAuthActionTypes.AuthCheckSuccessAction:
|
|
311
285
|
return Object.assign(Object.assign({}, state), { loggedIn: true, loading: false, errors: [] });
|
|
312
286
|
case DaffAuthActionTypes.AuthCheckFailureAction:
|
|
287
|
+
case DaffAuthActionTypes.AuthGuardLogoutAction:
|
|
313
288
|
return Object.assign(Object.assign({}, state), { loggedIn: false, loading: false, errors: [action.errorMessage] });
|
|
314
289
|
case DaffAuthActionTypes.AuthServerSideAction:
|
|
315
290
|
case DaffAuthActionTypes.AuthStorageFailureAction:
|
|
316
291
|
return Object.assign(Object.assign({}, state), { loading: false, errors: [action.errorMessage] });
|
|
317
|
-
case
|
|
292
|
+
case DaffAuthLoginActionTypes.LoginSuccessAction:
|
|
318
293
|
return Object.assign(Object.assign({}, state), { loggedIn: true });
|
|
319
|
-
case
|
|
294
|
+
case DaffAuthRegisterActionTypes.RegisterSuccessAction:
|
|
295
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction:
|
|
296
|
+
return action.token ? Object.assign(Object.assign({}, state), { loggedIn: true }) : state;
|
|
297
|
+
case DaffAuthLoginActionTypes.LogoutSuccessAction:
|
|
320
298
|
return Object.assign(Object.assign({}, state), { loggedIn: false });
|
|
321
299
|
default:
|
|
322
300
|
return state;
|
|
@@ -578,23 +556,17 @@ const provideDaffAuthStateConfig = (config) => ({
|
|
|
578
556
|
});
|
|
579
557
|
|
|
580
558
|
class DaffAuthEffects {
|
|
581
|
-
constructor(actions$,
|
|
559
|
+
constructor(actions$, tokenCheck, errorMatcher, storage, config, clientCache) {
|
|
582
560
|
this.actions$ = actions$;
|
|
583
|
-
this.
|
|
561
|
+
this.tokenCheck = tokenCheck;
|
|
584
562
|
this.errorMatcher = errorMatcher;
|
|
585
563
|
this.storage = storage;
|
|
586
564
|
this.config = config;
|
|
587
|
-
this.
|
|
588
|
-
this.
|
|
589
|
-
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.
|
|
590
|
-
// don't remove token when guard check completes with true result
|
|
591
|
-
if (action.type === DaffAuthActionTypes.AuthGuardCheckCompletionAction && action.result) {
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
return true;
|
|
595
|
-
}), tap(() => {
|
|
565
|
+
this.clientCache = clientCache;
|
|
566
|
+
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))))))));
|
|
567
|
+
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction), tap(() => {
|
|
596
568
|
this.storage.removeAuthToken();
|
|
597
|
-
}),
|
|
569
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
598
570
|
switch (true) {
|
|
599
571
|
case error instanceof DaffServerSideStorageError:
|
|
600
572
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -602,7 +574,7 @@ class DaffAuthEffects {
|
|
|
602
574
|
default:
|
|
603
575
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
604
576
|
}
|
|
605
|
-
})));
|
|
577
|
+
})), { dispatch: false });
|
|
606
578
|
// this needs to be defined after `check$` or else the driver call won't be run
|
|
607
579
|
this.authCheckInterval$ = createEffect(() => of(new DaffAuthCheck()).pipe(repeat({ delay: this.config.checkInterval }), filter(() => !!this.storage.getAuthToken()), catchError((error) => {
|
|
608
580
|
switch (true) {
|
|
@@ -614,22 +586,25 @@ class DaffAuthEffects {
|
|
|
614
586
|
return EMPTY;
|
|
615
587
|
}
|
|
616
588
|
})));
|
|
589
|
+
this.clearClientCache$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction, DaffAuthActionTypes.AuthGuardLogoutAction, DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
590
|
+
this.clientCache.reset();
|
|
591
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
617
592
|
}
|
|
618
593
|
}
|
|
619
|
-
/** @nocollapse */ DaffAuthEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, deps: [{ token: i1$1.Actions }, { token:
|
|
594
|
+
/** @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 });
|
|
620
595
|
/** @nocollapse */ DaffAuthEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects });
|
|
621
596
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, decorators: [{
|
|
622
597
|
type: Injectable
|
|
623
598
|
}], ctorParameters: function () {
|
|
624
|
-
return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
625
|
-
type: Inject,
|
|
626
|
-
args: [DaffAuthDriver]
|
|
627
|
-
}] }, { type: undefined, decorators: [{
|
|
599
|
+
return [{ type: i1$1.Actions }, { type: i2.DaffAuthDriverTokenCheck }, { type: undefined, decorators: [{
|
|
628
600
|
type: Inject,
|
|
629
601
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
630
|
-
}] }, { type: i2.DaffAuthStorageService }, { type: undefined, decorators: [{
|
|
602
|
+
}] }, { type: i2$1.DaffAuthStorageService }, { type: undefined, decorators: [{
|
|
631
603
|
type: Inject,
|
|
632
604
|
args: [DAFF_AUTH_STATE_CONFIG]
|
|
605
|
+
}] }, { type: undefined, decorators: [{
|
|
606
|
+
type: Inject,
|
|
607
|
+
args: [DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE]
|
|
633
608
|
}] }];
|
|
634
609
|
} });
|
|
635
610
|
|
|
@@ -643,7 +618,7 @@ class DaffAuthLoginEffects {
|
|
|
643
618
|
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))))))));
|
|
644
619
|
this.removeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutSuccessAction), tap(() => {
|
|
645
620
|
this.storage.removeAuthToken();
|
|
646
|
-
}),
|
|
621
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
647
622
|
switch (true) {
|
|
648
623
|
case error instanceof DaffServerSideStorageError:
|
|
649
624
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -651,10 +626,10 @@ class DaffAuthLoginEffects {
|
|
|
651
626
|
default:
|
|
652
627
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
653
628
|
}
|
|
654
|
-
})));
|
|
629
|
+
})), { dispatch: false });
|
|
655
630
|
this.storeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction), tap((action) => {
|
|
656
631
|
this.storage.setAuthToken(action.auth.token);
|
|
657
|
-
}),
|
|
632
|
+
}), switchMap(() => EMPTY), catchError((error) => {
|
|
658
633
|
switch (true) {
|
|
659
634
|
case error instanceof DaffServerSideStorageError:
|
|
660
635
|
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
@@ -662,10 +637,10 @@ class DaffAuthLoginEffects {
|
|
|
662
637
|
default:
|
|
663
638
|
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
664
639
|
}
|
|
665
|
-
})));
|
|
640
|
+
})), { dispatch: false });
|
|
666
641
|
}
|
|
667
642
|
}
|
|
668
|
-
/** @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 });
|
|
643
|
+
/** @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 });
|
|
669
644
|
/** @nocollapse */ DaffAuthLoginEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects });
|
|
670
645
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, decorators: [{
|
|
671
646
|
type: Injectable
|
|
@@ -676,7 +651,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
676
651
|
}] }, { type: undefined, decorators: [{
|
|
677
652
|
type: Inject,
|
|
678
653
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
679
|
-
}] }, { type: i2.DaffAuthStorageService }];
|
|
654
|
+
}] }, { type: i2$1.DaffAuthStorageService }];
|
|
680
655
|
} });
|
|
681
656
|
|
|
682
657
|
class DaffAuthRegisterEffects {
|
|
@@ -685,7 +660,7 @@ class DaffAuthRegisterEffects {
|
|
|
685
660
|
this.registerDriver = registerDriver;
|
|
686
661
|
this.errorMatcher = errorMatcher;
|
|
687
662
|
this.storage = storage;
|
|
688
|
-
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)),
|
|
663
|
+
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) => {
|
|
689
664
|
switch (true) {
|
|
690
665
|
case error instanceof DaffServerSideStorageError:
|
|
691
666
|
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
@@ -697,7 +672,7 @@ class DaffAuthRegisterEffects {
|
|
|
697
672
|
})))));
|
|
698
673
|
}
|
|
699
674
|
}
|
|
700
|
-
/** @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 });
|
|
675
|
+
/** @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 });
|
|
701
676
|
/** @nocollapse */ DaffAuthRegisterEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects });
|
|
702
677
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, decorators: [{
|
|
703
678
|
type: Injectable
|
|
@@ -708,7 +683,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
708
683
|
}] }, { type: undefined, decorators: [{
|
|
709
684
|
type: Inject,
|
|
710
685
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
711
|
-
}] }, { type: i2.DaffAuthStorageService }];
|
|
686
|
+
}] }, { type: i2$1.DaffAuthStorageService }];
|
|
712
687
|
} });
|
|
713
688
|
|
|
714
689
|
class DaffAuthResetPasswordEffects {
|
|
@@ -718,7 +693,7 @@ class DaffAuthResetPasswordEffects {
|
|
|
718
693
|
this.errorMatcher = errorMatcher;
|
|
719
694
|
this.storage = storage;
|
|
720
695
|
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))))))));
|
|
721
|
-
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)),
|
|
696
|
+
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) => {
|
|
722
697
|
switch (true) {
|
|
723
698
|
case error instanceof DaffServerSideStorageError:
|
|
724
699
|
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
@@ -730,7 +705,7 @@ class DaffAuthResetPasswordEffects {
|
|
|
730
705
|
})))));
|
|
731
706
|
}
|
|
732
707
|
}
|
|
733
|
-
/** @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 });
|
|
708
|
+
/** @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 });
|
|
734
709
|
/** @nocollapse */ DaffAuthResetPasswordEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects });
|
|
735
710
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, decorators: [{
|
|
736
711
|
type: Injectable
|
|
@@ -741,7 +716,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
741
716
|
}] }, { type: undefined, decorators: [{
|
|
742
717
|
type: Inject,
|
|
743
718
|
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
744
|
-
}] }, { type: i2.DaffAuthStorageService }];
|
|
719
|
+
}] }, { type: i2$1.DaffAuthStorageService }];
|
|
745
720
|
} });
|
|
746
721
|
|
|
747
722
|
class DaffAuthStateModule {
|
|
@@ -784,5 +759,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
784
759
|
* Generated bundle index. Do not edit.
|
|
785
760
|
*/
|
|
786
761
|
|
|
787
|
-
export { DAFF_AUTH_STATE_CONFIG, DAFF_AUTH_STORE_FEATURE_KEY, DaffAuthActionTypes, DaffAuthCheck, DaffAuthCheckFailure, DaffAuthCheckSuccess,
|
|
762
|
+
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 };
|
|
788
763
|
//# sourceMappingURL=daffodil-auth-state.mjs.map
|