@sneat/auth-core 0.1.3 → 0.1.6
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/esm2022/index.js +8 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/login-required-service.service.js +20 -0
- package/esm2022/lib/login-required-service.service.js.map +1 -0
- package/esm2022/lib/private-token-store.service.js +36 -0
- package/esm2022/lib/private-token-store.service.js.map +1 -0
- package/esm2022/lib/sneat-auth-guard.js +79 -0
- package/esm2022/lib/sneat-auth-guard.js.map +1 -0
- package/esm2022/lib/sneat-auth-state-service.js +267 -0
- package/esm2022/lib/sneat-auth-state-service.js.map +1 -0
- package/{src/lib/sneat-auth.interface.ts → esm2022/lib/sneat-auth.interface.js} +1 -5
- package/esm2022/lib/sneat-auth.interface.js.map +1 -0
- package/esm2022/lib/telegram-auth.service.js +39 -0
- package/esm2022/lib/telegram-auth.service.js.map +1 -0
- package/esm2022/lib/user/index.js +3 -0
- package/esm2022/lib/user/index.js.map +1 -0
- package/esm2022/lib/user/sneat-user.service.js +171 -0
- package/esm2022/lib/user/sneat-user.service.js.map +1 -0
- package/esm2022/lib/user/user-record.service.js +30 -0
- package/esm2022/lib/user/user-record.service.js.map +1 -0
- package/esm2022/sneat-auth-core.js +5 -0
- package/esm2022/sneat-auth-core.js.map +1 -0
- package/lib/login-required-service.service.d.ts +6 -0
- package/lib/private-token-store.service.d.ts +8 -0
- package/lib/sneat-auth-guard.d.ts +26 -0
- package/lib/sneat-auth-state-service.d.ts +51 -0
- package/lib/sneat-auth.interface.d.ts +5 -0
- package/lib/telegram-auth.service.d.ts +9 -0
- package/lib/user/sneat-user.service.d.ts +34 -0
- package/lib/user/user-record.service.d.ts +25 -0
- package/package.json +14 -2
- package/sneat-auth-core.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
- package/eslint.config.js +0 -7
- package/ng-package.json +0 -7
- package/project.json +0 -38
- package/src/lib/login-required-service.service.spec.ts +0 -39
- package/src/lib/login-required-service.service.ts +0 -14
- package/src/lib/private-token-store.service.spec.ts +0 -75
- package/src/lib/private-token-store.service.ts +0 -36
- package/src/lib/sneat-auth-guard.spec.ts +0 -124
- package/src/lib/sneat-auth-guard.ts +0 -107
- package/src/lib/sneat-auth-state-service.spec.ts +0 -332
- package/src/lib/sneat-auth-state-service.ts +0 -387
- package/src/lib/sneat-auth.interface.spec.ts +0 -39
- package/src/lib/telegram-auth.service.spec.ts +0 -186
- package/src/lib/telegram-auth.service.ts +0 -49
- package/src/lib/user/sneat-user.service.spec.ts +0 -151
- package/src/lib/user/sneat-user.service.ts +0 -266
- package/src/lib/user/user-record.service.spec.ts +0 -145
- package/src/lib/user/user-record.service.ts +0 -38
- package/src/test-setup.ts +0 -3
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -19
- package/tsconfig.lib.prod.json +0 -7
- package/tsconfig.spec.json +0 -31
- package/vite.config.mts +0 -10
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/lib/user/index.ts → lib/user/index.d.ts} +0 -0
package/project.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth-core",
|
|
3
|
-
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"projectType": "library",
|
|
5
|
-
"sourceRoot": "libs/auth/core/src",
|
|
6
|
-
"prefix": "sneat",
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/angular:ng-packagr-lite",
|
|
10
|
-
"outputs": [
|
|
11
|
-
"{workspaceRoot}/dist/libs/auth/core"
|
|
12
|
-
],
|
|
13
|
-
"options": {
|
|
14
|
-
"project": "libs/auth/core/ng-package.json",
|
|
15
|
-
"tsConfig": "libs/auth/core/tsconfig.lib.json"
|
|
16
|
-
},
|
|
17
|
-
"configurations": {
|
|
18
|
-
"production": {
|
|
19
|
-
"tsConfig": "libs/auth/core/tsconfig.lib.prod.json"
|
|
20
|
-
},
|
|
21
|
-
"development": {}
|
|
22
|
-
},
|
|
23
|
-
"defaultConfiguration": "production"
|
|
24
|
-
},
|
|
25
|
-
"test": {
|
|
26
|
-
"executor": "@nx/vitest:test",
|
|
27
|
-
"outputs": [
|
|
28
|
-
"{workspaceRoot}/coverage/libs/auth/core"
|
|
29
|
-
],
|
|
30
|
-
"options": {
|
|
31
|
-
"tsConfig": "libs/auth/core/tsconfig.spec.json"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"lint": {
|
|
35
|
-
"executor": "@nx/eslint:lint"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { LoginRequiredServiceService } from './login-required-service.service';
|
|
3
|
-
import { SneatAuthStateService } from './sneat-auth-state-service';
|
|
4
|
-
import { of } from 'rxjs';
|
|
5
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
6
|
-
|
|
7
|
-
describe('LoginRequiredServiceService', () => {
|
|
8
|
-
let authStateMock: { authState: ReturnType<typeof of> };
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
authStateMock = {
|
|
12
|
-
authState: of({
|
|
13
|
-
status: 'authenticated',
|
|
14
|
-
user: { uid: 'test-uid', email: 'test@example.com' },
|
|
15
|
-
}),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
TestBed.configureTestingModule({
|
|
19
|
-
providers: [
|
|
20
|
-
LoginRequiredServiceService,
|
|
21
|
-
{
|
|
22
|
-
provide: SneatAuthStateService,
|
|
23
|
-
useValue: authStateMock,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should be created', () => {
|
|
30
|
-
const service = TestBed.inject(LoginRequiredServiceService);
|
|
31
|
-
expect(service).toBeTruthy();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should subscribe to auth state changes', () => {
|
|
35
|
-
const subscribeSpy = vi.spyOn(authStateMock.authState, 'subscribe');
|
|
36
|
-
TestBed.inject(LoginRequiredServiceService);
|
|
37
|
-
expect(subscribeSpy).toHaveBeenCalled();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Injectable, inject } from '@angular/core';
|
|
2
|
-
import { SneatAuthStateService } from './sneat-auth-state-service';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class LoginRequiredServiceService {
|
|
8
|
-
constructor() {
|
|
9
|
-
const authState = inject(SneatAuthStateService);
|
|
10
|
-
authState.authState.subscribe(() => {
|
|
11
|
-
// Intentionally empty - just subscribing to trigger the observable
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import {
|
|
3
|
-
PrivateTokenStoreService,
|
|
4
|
-
canceledByUser,
|
|
5
|
-
} from './private-token-store.service';
|
|
6
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
|
-
import { firstValueFrom } from 'rxjs';
|
|
8
|
-
|
|
9
|
-
describe('PrivateTokenStoreService', () => {
|
|
10
|
-
let service: PrivateTokenStoreService;
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
TestBed.configureTestingModule({
|
|
14
|
-
providers: [PrivateTokenStoreService],
|
|
15
|
-
});
|
|
16
|
-
service = TestBed.inject(PrivateTokenStoreService);
|
|
17
|
-
localStorage.clear();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should be created', () => {
|
|
21
|
-
expect(service).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should return token from localStorage if available', async () => {
|
|
25
|
-
const domain = 'test.com';
|
|
26
|
-
const projectId = 'proj123';
|
|
27
|
-
const token = 'stored-token-123';
|
|
28
|
-
|
|
29
|
-
localStorage.setItem(`private/tokens/${domain}/${projectId}`, token);
|
|
30
|
-
|
|
31
|
-
const result = await firstValueFrom(
|
|
32
|
-
service.getPrivateToken(domain, projectId),
|
|
33
|
-
);
|
|
34
|
-
expect(result).toBe(token);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should prompt user for token if not in localStorage', async () => {
|
|
38
|
-
const domain = 'test.com';
|
|
39
|
-
const projectId = 'proj456';
|
|
40
|
-
const token = 'new-token-456';
|
|
41
|
-
|
|
42
|
-
// Mock the global prompt function
|
|
43
|
-
globalThis.prompt = vi.fn().mockReturnValue(token);
|
|
44
|
-
|
|
45
|
-
const promise = firstValueFrom(service.getPrivateToken(domain, projectId));
|
|
46
|
-
|
|
47
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
48
|
-
|
|
49
|
-
const result = await promise;
|
|
50
|
-
expect(result).toBe(token);
|
|
51
|
-
expect(localStorage.getItem(`private/tokens/${domain}/${projectId}`)).toBe(
|
|
52
|
-
token,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
// Cleanup
|
|
56
|
-
delete (globalThis as { prompt?: unknown }).prompt;
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should error with canceledByUser if user cancels prompt', async () => {
|
|
60
|
-
const domain = 'test.com';
|
|
61
|
-
const projectId = 'proj789';
|
|
62
|
-
|
|
63
|
-
// Mock the global prompt function
|
|
64
|
-
globalThis.prompt = vi.fn().mockReturnValue(null);
|
|
65
|
-
|
|
66
|
-
const promise = firstValueFrom(service.getPrivateToken(domain, projectId));
|
|
67
|
-
|
|
68
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
69
|
-
|
|
70
|
-
await expect(promise).rejects.toBe(canceledByUser);
|
|
71
|
-
|
|
72
|
-
// Cleanup
|
|
73
|
-
delete (globalThis as { prompt?: unknown }).prompt;
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Observable, of, Subject } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
const tokenKey = (domain: string, projectId: string) =>
|
|
5
|
-
`private/tokens/${domain}/${projectId}`;
|
|
6
|
-
|
|
7
|
-
export const canceledByUser = 'canceled by user';
|
|
8
|
-
|
|
9
|
-
@Injectable({
|
|
10
|
-
providedIn: 'root',
|
|
11
|
-
})
|
|
12
|
-
export class PrivateTokenStoreService {
|
|
13
|
-
public getPrivateToken(
|
|
14
|
-
domain: string,
|
|
15
|
-
projectId: string,
|
|
16
|
-
): Observable<string> {
|
|
17
|
-
// Consider storing all tokens in a single item
|
|
18
|
-
const key = tokenKey(domain, projectId);
|
|
19
|
-
let token = localStorage.getItem(key);
|
|
20
|
-
if (token) {
|
|
21
|
-
return of(token);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const subj = new Subject<string>();
|
|
25
|
-
setTimeout(() => {
|
|
26
|
-
token = prompt(`Please provide access token for ${domain}:`);
|
|
27
|
-
if (token) {
|
|
28
|
-
localStorage.setItem(key, token);
|
|
29
|
-
subj.next(token);
|
|
30
|
-
} else {
|
|
31
|
-
subj.error(canceledByUser);
|
|
32
|
-
}
|
|
33
|
-
}, 1);
|
|
34
|
-
return subj.asObservable();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import {
|
|
3
|
-
Router,
|
|
4
|
-
Route,
|
|
5
|
-
UrlSegment,
|
|
6
|
-
ActivatedRouteSnapshot,
|
|
7
|
-
RouterStateSnapshot,
|
|
8
|
-
} from '@angular/router';
|
|
9
|
-
import { Auth } from '@angular/fire/auth';
|
|
10
|
-
import {
|
|
11
|
-
SneatAuthGuard,
|
|
12
|
-
redirectToLoginIfNotSignedIn,
|
|
13
|
-
} from './sneat-auth-guard';
|
|
14
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
15
|
-
import { of, firstValueFrom } from 'rxjs';
|
|
16
|
-
|
|
17
|
-
describe('SneatAuthGuard', () => {
|
|
18
|
-
let guard: SneatAuthGuard;
|
|
19
|
-
let routerMock: {
|
|
20
|
-
createUrlTree: ReturnType<typeof vi.fn>;
|
|
21
|
-
parseUrl: ReturnType<typeof vi.fn>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
routerMock = {
|
|
26
|
-
createUrlTree: vi.fn(),
|
|
27
|
-
parseUrl: vi.fn(),
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
TestBed.configureTestingModule({
|
|
31
|
-
providers: [
|
|
32
|
-
SneatAuthGuard,
|
|
33
|
-
{ provide: Router, useValue: routerMock },
|
|
34
|
-
{
|
|
35
|
-
provide: Auth,
|
|
36
|
-
useValue: {},
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
guard = TestBed.inject(SneatAuthGuard);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should be created', () => {
|
|
45
|
-
expect(guard).toBeTruthy();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('canLoad', () => {
|
|
49
|
-
it('should return true', () => {
|
|
50
|
-
const route: Route = { path: 'test' };
|
|
51
|
-
const segments: UrlSegment[] = [];
|
|
52
|
-
|
|
53
|
-
const result = guard.canLoad(route, segments);
|
|
54
|
-
expect(result).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('canActivate', () => {
|
|
59
|
-
it('should return true', () => {
|
|
60
|
-
const route = {} as ActivatedRouteSnapshot;
|
|
61
|
-
const state = { url: '/test' } as RouterStateSnapshot;
|
|
62
|
-
|
|
63
|
-
const result = guard.canActivate(route, state);
|
|
64
|
-
expect(result).toBe(true);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
describe('canActivateChild', () => {
|
|
69
|
-
it('should return true', () => {
|
|
70
|
-
const childRoute = {} as ActivatedRouteSnapshot;
|
|
71
|
-
const state = { url: '/test/child' } as RouterStateSnapshot;
|
|
72
|
-
|
|
73
|
-
const result = guard.canActivateChild(childRoute, state);
|
|
74
|
-
expect(result).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe('redirectToLoginIfNotSignedIn', () => {
|
|
80
|
-
it('should return true for authenticated user', async () => {
|
|
81
|
-
const user = { uid: 'test-uid' };
|
|
82
|
-
|
|
83
|
-
const result = await firstValueFrom(
|
|
84
|
-
of(user).pipe(redirectToLoginIfNotSignedIn),
|
|
85
|
-
);
|
|
86
|
-
expect(result).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should return login URL for unauthenticated user at root', async () => {
|
|
90
|
-
const originalPathname = location.pathname;
|
|
91
|
-
Object.defineProperty(window.location, 'pathname', {
|
|
92
|
-
writable: true,
|
|
93
|
-
value: '/',
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const result = await firstValueFrom(
|
|
97
|
-
of(null).pipe(redirectToLoginIfNotSignedIn),
|
|
98
|
-
);
|
|
99
|
-
expect(result).toBe('/login');
|
|
100
|
-
|
|
101
|
-
Object.defineProperty(window.location, 'pathname', {
|
|
102
|
-
writable: true,
|
|
103
|
-
value: originalPathname,
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should return login URL with hash for unauthenticated user at non-root path', async () => {
|
|
108
|
-
const originalPathname = location.pathname;
|
|
109
|
-
Object.defineProperty(window.location, 'pathname', {
|
|
110
|
-
writable: true,
|
|
111
|
-
value: '/protected',
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const result = await firstValueFrom(
|
|
115
|
-
of(null).pipe(redirectToLoginIfNotSignedIn),
|
|
116
|
-
);
|
|
117
|
-
expect(result).toBe('/login#/protected');
|
|
118
|
-
|
|
119
|
-
Object.defineProperty(window.location, 'pathname', {
|
|
120
|
-
writable: true,
|
|
121
|
-
value: originalPathname,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActivatedRouteSnapshot,
|
|
3
|
-
// CanActivate,
|
|
4
|
-
// CanActivateChild,
|
|
5
|
-
// CanLoad,
|
|
6
|
-
Route,
|
|
7
|
-
Router,
|
|
8
|
-
RouterStateSnapshot,
|
|
9
|
-
UrlSegment,
|
|
10
|
-
UrlTree,
|
|
11
|
-
} from '@angular/router';
|
|
12
|
-
import { Observable } from 'rxjs';
|
|
13
|
-
import { Injectable, inject } from '@angular/core';
|
|
14
|
-
import { Auth } from '@angular/fire/auth';
|
|
15
|
-
import { map } from 'rxjs/operators';
|
|
16
|
-
import { AuthPipe } from '@angular/fire/auth-guard';
|
|
17
|
-
|
|
18
|
-
type AuthCanLoadPipeGenerator = (
|
|
19
|
-
route: Route,
|
|
20
|
-
segments: UrlSegment[],
|
|
21
|
-
) => AuthPipe;
|
|
22
|
-
|
|
23
|
-
export const redirectToLoginIfNotSignedIn: AuthPipe = map((user) => {
|
|
24
|
-
if (user) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
let url = '/login';
|
|
28
|
-
if (location.pathname != '/') {
|
|
29
|
-
url += '#' + location.pathname;
|
|
30
|
-
}
|
|
31
|
-
return url;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
@Injectable({
|
|
35
|
-
providedIn: 'root',
|
|
36
|
-
})
|
|
37
|
-
export class SneatAuthGuard /*implements CanLoad, CanActivate, CanActivateChild*/ {
|
|
38
|
-
private readonly router = inject(Router);
|
|
39
|
-
private readonly auth = inject(Auth);
|
|
40
|
-
|
|
41
|
-
public canLoad(
|
|
42
|
-
_route: Route,
|
|
43
|
-
_segments: UrlSegment[],
|
|
44
|
-
):
|
|
45
|
-
| Observable<boolean | UrlTree>
|
|
46
|
-
| Promise<boolean | UrlTree>
|
|
47
|
-
| boolean
|
|
48
|
-
| UrlTree {
|
|
49
|
-
{
|
|
50
|
-
// console.log('SneatAuthGuard.canLoad', route, segments);
|
|
51
|
-
// const authPipeFactory =
|
|
52
|
-
// (route.data && route.data['authCanLoadGuardPipe'] as AuthCanLoadPipeGenerator) ||
|
|
53
|
-
// (() => redirectToLoginIfNotSignedIn);
|
|
54
|
-
// const subj = new Subject<boolean>();
|
|
55
|
-
// onAuthStateChanged(this.auth, {
|
|
56
|
-
// next: (user) => {
|
|
57
|
-
// console.log('onAuthStateChanged', user);
|
|
58
|
-
// }
|
|
59
|
-
// })
|
|
60
|
-
// return this.auth.user.pipe(
|
|
61
|
-
// map((user) => {
|
|
62
|
-
// console.log('user', user);
|
|
63
|
-
// return user;
|
|
64
|
-
// }),
|
|
65
|
-
// take(1),
|
|
66
|
-
// authPipeFactory(route, segments),
|
|
67
|
-
// map((can) => {
|
|
68
|
-
// console.log('can', can);
|
|
69
|
-
// if (typeof can === 'boolean') {
|
|
70
|
-
// return can;
|
|
71
|
-
// } else if (Array.isArray(can)) {
|
|
72
|
-
// return this.router.createUrlTree(can);
|
|
73
|
-
// } else {
|
|
74
|
-
// return this.router.parseUrl(can);
|
|
75
|
-
// }
|
|
76
|
-
// }),
|
|
77
|
-
// );
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public canActivate(
|
|
83
|
-
_route: ActivatedRouteSnapshot,
|
|
84
|
-
_state: RouterStateSnapshot, //: Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree
|
|
85
|
-
) {
|
|
86
|
-
// console.log('SneatAuthGuard.canActivate', route, state);
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
canActivateChild(
|
|
91
|
-
_childRoute: ActivatedRouteSnapshot,
|
|
92
|
-
_state: RouterStateSnapshot, // : Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree
|
|
93
|
-
) {
|
|
94
|
-
// console.log('SneatAuthGuard.canActivateChild', childRoute, state);
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const canLoad = (pipe?: AuthCanLoadPipeGenerator) => ({
|
|
100
|
-
canLoad: [SneatAuthGuard],
|
|
101
|
-
data: { authCanLoadGuardPipe: pipe },
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export const SNEAT_AUTH_GUARDS = {
|
|
105
|
-
canActivate: [SneatAuthGuard],
|
|
106
|
-
canLoad: [SneatAuthGuard],
|
|
107
|
-
};
|