@abp/ng.core 7.0.0-rc.5 → 7.0.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/esm2020/lib/abstracts/auth.guard.mjs +17 -0
- package/esm2020/lib/abstracts/auth.service.mjs +42 -0
- package/esm2020/lib/abstracts/index.mjs +3 -1
- package/esm2020/lib/core.module.mjs +6 -34
- package/esm2020/lib/guards/index.mjs +1 -2
- package/esm2020/lib/interceptors/api.interceptor.mjs +11 -40
- package/esm2020/lib/models/auth.mjs +1 -1
- package/esm2020/lib/models/environment.mjs +1 -1
- package/esm2020/lib/models/index.mjs +2 -2
- package/esm2020/lib/services/index.mjs +1 -3
- package/esm2020/lib/tokens/check-authentication-state.mjs +3 -0
- package/esm2020/lib/tokens/index.mjs +4 -1
- package/esm2020/lib/tokens/manage-profile.token.mjs +3 -12
- package/esm2020/lib/tokens/pipe-to-login.token.mjs +3 -0
- package/esm2020/lib/tokens/set-token-response-to-storage.token.mjs +3 -0
- package/esm2020/lib/utils/index.mjs +1 -2
- package/esm2020/lib/utils/initial-utils.mjs +15 -18
- package/esm2020/public-api.mjs +2 -2
- package/fesm2015/abp-ng.core.mjs +188 -522
- package/fesm2015/abp-ng.core.mjs.map +1 -1
- package/fesm2020/abp-ng.core.mjs +188 -505
- package/fesm2020/abp-ng.core.mjs.map +1 -1
- package/lib/{guards → abstracts}/auth.guard.d.ts +3 -6
- package/lib/{services → abstracts}/auth.service.d.ts +17 -7
- package/lib/abstracts/index.d.ts +2 -0
- package/lib/core.module.d.ts +7 -10
- package/lib/guards/index.d.ts +0 -1
- package/lib/interceptors/api.interceptor.d.ts +7 -9
- package/lib/models/auth.d.ts +5 -0
- package/lib/models/environment.d.ts +1 -1
- package/lib/models/index.d.ts +1 -1
- package/lib/services/index.d.ts +0 -2
- package/lib/tokens/check-authentication-state.d.ts +3 -0
- package/lib/tokens/index.d.ts +3 -0
- package/lib/tokens/pipe-to-login.token.d.ts +3 -0
- package/lib/tokens/set-token-response-to-storage.token.d.ts +3 -0
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/initial-utils.d.ts +1 -170
- package/package.json +2 -2
- package/public-api.d.ts +1 -1
- package/esm2020/lib/guards/auth.guard.mjs +0 -29
- package/esm2020/lib/handlers/oauth-configuration.handler.mjs +0 -37
- package/esm2020/lib/services/auth.service.mjs +0 -44
- package/esm2020/lib/services/timeout-limited-oauth.service.mjs +0 -16
- package/esm2020/lib/strategies/auth-flow.strategy.mjs +0 -190
- package/esm2020/lib/utils/auth-utils.mjs +0 -42
- package/lib/handlers/oauth-configuration.handler.d.ts +0 -13
- package/lib/services/timeout-limited-oauth.service.d.ts +0 -7
- package/lib/strategies/auth-flow.strategy.d.ts +0 -393
- package/lib/utils/auth-utils.d.ts +0 -175
package/fesm2020/abp-ng.core.mjs
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ChangeDetectorRef, Component, Input,
|
|
2
|
+
import { ChangeDetectorRef, Component, Input, Injectable, InjectionToken, Inject, isDevMode, Optional, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, ComponentFactoryResolver, ApplicationRef } from '@angular/core';
|
|
3
|
+
import { of, BehaviorSubject, Subject, throwError, combineLatest, from, Subscription, fromEvent, ReplaySubject, lastValueFrom, Observable, timer, concat } from 'rxjs';
|
|
3
4
|
import * as i1$1 from '@angular/router';
|
|
4
5
|
import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
5
6
|
import * as i5 from '@angular/common';
|
|
6
7
|
import { registerLocaleData, DOCUMENT, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
|
|
7
|
-
import {
|
|
8
|
-
import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, finalize, retryWhen, delay, shareReplay } from 'rxjs/operators';
|
|
8
|
+
import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, retryWhen, delay, shareReplay, finalize } from 'rxjs/operators';
|
|
9
9
|
import * as i1 from '@angular/common/http';
|
|
10
|
-
import { HttpParams,
|
|
10
|
+
import { HttpParams, HttpClient, HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
|
|
11
11
|
import compare from 'just-compare';
|
|
12
12
|
import * as i1$2 from '@angular/forms';
|
|
13
13
|
import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
14
|
-
import * as i1$3 from 'angular-oauth2-oidc';
|
|
15
|
-
import { OAuthStorage, OAuthService, OAuthErrorEvent, OAuthInfoEvent, OAuthModule } from 'angular-oauth2-oidc';
|
|
16
14
|
import clone from 'just-clone';
|
|
17
15
|
|
|
18
16
|
// Not an abstract class on purpose. Do not change!
|
|
@@ -72,6 +70,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
72
70
|
type: Input
|
|
73
71
|
}] } });
|
|
74
72
|
|
|
73
|
+
class AuthGuard {
|
|
74
|
+
canActivate() {
|
|
75
|
+
console.error('You should add @abp/ng-oauth packages or create your own auth packages.');
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
80
|
+
AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, providedIn: 'root' });
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, decorators: [{
|
|
82
|
+
type: Injectable,
|
|
83
|
+
args: [{
|
|
84
|
+
providedIn: 'root',
|
|
85
|
+
}]
|
|
86
|
+
}] });
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Abstract service for Authentication.
|
|
90
|
+
*/
|
|
91
|
+
class AuthService {
|
|
92
|
+
constructor() { }
|
|
93
|
+
warningMessage() {
|
|
94
|
+
console.error('You should add @abp/ng-oauth packages or create your own auth packages.');
|
|
95
|
+
}
|
|
96
|
+
init() {
|
|
97
|
+
this.warningMessage();
|
|
98
|
+
return Promise.resolve(undefined);
|
|
99
|
+
}
|
|
100
|
+
login(params) {
|
|
101
|
+
this.warningMessage();
|
|
102
|
+
return of(undefined);
|
|
103
|
+
}
|
|
104
|
+
logout(queryParams) {
|
|
105
|
+
this.warningMessage();
|
|
106
|
+
return of(undefined);
|
|
107
|
+
}
|
|
108
|
+
navigateToLogin(queryParams) { }
|
|
109
|
+
get isInternalAuth() {
|
|
110
|
+
throw new Error('not implemented');
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
get isAuthenticated() {
|
|
114
|
+
this.warningMessage();
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
119
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, decorators: [{
|
|
121
|
+
type: Injectable,
|
|
122
|
+
args: [{
|
|
123
|
+
providedIn: 'root',
|
|
124
|
+
}]
|
|
125
|
+
}], ctorParameters: function () { return []; } });
|
|
126
|
+
|
|
75
127
|
const LOCALIZATIONS = new InjectionToken('LOCALIZATIONS');
|
|
76
128
|
function localizationContributor(localizations) {
|
|
77
129
|
if (localizations) {
|
|
@@ -2237,34 +2289,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
2237
2289
|
args: ['click.stop']
|
|
2238
2290
|
}] } });
|
|
2239
2291
|
|
|
2240
|
-
class OAuthConfigurationHandler {
|
|
2241
|
-
constructor(oAuthService, environmentService, options) {
|
|
2242
|
-
this.oAuthService = oAuthService;
|
|
2243
|
-
this.environmentService = environmentService;
|
|
2244
|
-
this.options = options;
|
|
2245
|
-
this.listenToSetEnvironment();
|
|
2246
|
-
}
|
|
2247
|
-
listenToSetEnvironment() {
|
|
2248
|
-
this.environmentService
|
|
2249
|
-
.createOnUpdateStream(state => state)
|
|
2250
|
-
.pipe(map(environment => environment.oAuthConfig), filter(config => !compare(config, this.options.environment.oAuthConfig)))
|
|
2251
|
-
.subscribe(config => {
|
|
2252
|
-
this.oAuthService.configure(config);
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
OAuthConfigurationHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, deps: [{ token: i1$3.OAuthService }, { token: EnvironmentService }, { token: CORE_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2257
|
-
OAuthConfigurationHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, providedIn: 'root' });
|
|
2258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, decorators: [{
|
|
2259
|
-
type: Injectable,
|
|
2260
|
-
args: [{
|
|
2261
|
-
providedIn: 'root',
|
|
2262
|
-
}]
|
|
2263
|
-
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: EnvironmentService }, { type: undefined, decorators: [{
|
|
2264
|
-
type: Inject,
|
|
2265
|
-
args: [CORE_OPTIONS]
|
|
2266
|
-
}] }]; } });
|
|
2267
|
-
|
|
2268
2292
|
class RoutesHandler {
|
|
2269
2293
|
constructor(routes, router) {
|
|
2270
2294
|
this.routes = routes;
|
|
@@ -2308,139 +2332,6 @@ function flatRoutes(routes, parent) {
|
|
|
2308
2332
|
}, []);
|
|
2309
2333
|
}
|
|
2310
2334
|
|
|
2311
|
-
function getPathName(url) {
|
|
2312
|
-
const { pathname } = new URL(url, window.location.origin);
|
|
2313
|
-
return pathname;
|
|
2314
|
-
}
|
|
2315
|
-
class WebHttpUrlEncodingCodec {
|
|
2316
|
-
encodeKey(k) {
|
|
2317
|
-
return encodeURIComponent(k);
|
|
2318
|
-
}
|
|
2319
|
-
encodeValue(v) {
|
|
2320
|
-
return encodeURIComponent(v);
|
|
2321
|
-
}
|
|
2322
|
-
decodeKey(k) {
|
|
2323
|
-
return decodeURIComponent(k);
|
|
2324
|
-
}
|
|
2325
|
-
decodeValue(v) {
|
|
2326
|
-
return decodeURIComponent(v);
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
const LOADER_DELAY = new InjectionToken('LOADER_DELAY');
|
|
2331
|
-
|
|
2332
|
-
class HttpWaitService {
|
|
2333
|
-
constructor(injector) {
|
|
2334
|
-
this.store = new InternalStore({
|
|
2335
|
-
requests: [],
|
|
2336
|
-
filteredRequests: [],
|
|
2337
|
-
});
|
|
2338
|
-
this.destroy$ = new Subject();
|
|
2339
|
-
this.delay = injector.get(LOADER_DELAY, 500);
|
|
2340
|
-
}
|
|
2341
|
-
getLoading() {
|
|
2342
|
-
return !!this.applyFilter(this.store.state.requests).length;
|
|
2343
|
-
}
|
|
2344
|
-
getLoading$() {
|
|
2345
|
-
return this.store
|
|
2346
|
-
.sliceState(({ requests }) => requests)
|
|
2347
|
-
.pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
|
|
2348
|
-
? this.delay === 0
|
|
2349
|
-
? of(true)
|
|
2350
|
-
: timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
|
|
2351
|
-
: of(false)), tap(() => this.destroy$.next()));
|
|
2352
|
-
}
|
|
2353
|
-
updateLoading$() {
|
|
2354
|
-
return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
|
|
2355
|
-
}
|
|
2356
|
-
clearLoading() {
|
|
2357
|
-
this.store.patch({ requests: [] });
|
|
2358
|
-
}
|
|
2359
|
-
addRequest(request) {
|
|
2360
|
-
this.store.patch({ requests: [...this.store.state.requests, request] });
|
|
2361
|
-
}
|
|
2362
|
-
deleteRequest(request) {
|
|
2363
|
-
const requests = this.store.state.requests.filter(r => r !== request);
|
|
2364
|
-
this.store.patch({ requests });
|
|
2365
|
-
}
|
|
2366
|
-
addFilter(request) {
|
|
2367
|
-
const requests = Array.isArray(request) ? request : [request];
|
|
2368
|
-
const filteredRequests = [
|
|
2369
|
-
...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
|
|
2370
|
-
...requests,
|
|
2371
|
-
];
|
|
2372
|
-
this.store.patch({ filteredRequests });
|
|
2373
|
-
}
|
|
2374
|
-
removeFilter(request) {
|
|
2375
|
-
const requests = Array.isArray(request) ? request : [request];
|
|
2376
|
-
const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
|
|
2377
|
-
this.store.patch({ filteredRequests });
|
|
2378
|
-
}
|
|
2379
|
-
applyFilter(requests) {
|
|
2380
|
-
const { filteredRequests } = this.store.state;
|
|
2381
|
-
return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
|
|
2382
|
-
}
|
|
2383
|
-
isSameRequest(filteredRequest, request) {
|
|
2384
|
-
const { method, endpoint } = filteredRequest;
|
|
2385
|
-
return endpoint === request.endpoint && method === request.method;
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
HttpWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2389
|
-
HttpWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, providedIn: 'root' });
|
|
2390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, decorators: [{
|
|
2391
|
-
type: Injectable,
|
|
2392
|
-
args: [{
|
|
2393
|
-
providedIn: 'root',
|
|
2394
|
-
}]
|
|
2395
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2396
|
-
|
|
2397
|
-
const TENANT_KEY = new InjectionToken('TENANT_KEY');
|
|
2398
|
-
|
|
2399
|
-
class ApiInterceptor {
|
|
2400
|
-
constructor(oAuthService, sessionState, httpWaitService, tenantKey) {
|
|
2401
|
-
this.oAuthService = oAuthService;
|
|
2402
|
-
this.sessionState = sessionState;
|
|
2403
|
-
this.httpWaitService = httpWaitService;
|
|
2404
|
-
this.tenantKey = tenantKey;
|
|
2405
|
-
}
|
|
2406
|
-
intercept(request, next) {
|
|
2407
|
-
this.httpWaitService.addRequest(request);
|
|
2408
|
-
return next
|
|
2409
|
-
.handle(request.clone({
|
|
2410
|
-
setHeaders: this.getAdditionalHeaders(request.headers),
|
|
2411
|
-
}))
|
|
2412
|
-
.pipe(finalize(() => this.httpWaitService.deleteRequest(request)));
|
|
2413
|
-
}
|
|
2414
|
-
getAdditionalHeaders(existingHeaders) {
|
|
2415
|
-
const headers = {};
|
|
2416
|
-
const token = this.oAuthService.getAccessToken();
|
|
2417
|
-
if (!existingHeaders?.has('Authorization') && token) {
|
|
2418
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
2419
|
-
}
|
|
2420
|
-
const lang = this.sessionState.getLanguage();
|
|
2421
|
-
if (!existingHeaders?.has('Accept-Language') && lang) {
|
|
2422
|
-
headers['Accept-Language'] = lang;
|
|
2423
|
-
}
|
|
2424
|
-
const tenant = this.sessionState.getTenant();
|
|
2425
|
-
if (!existingHeaders?.has(this.tenantKey) && tenant?.id) {
|
|
2426
|
-
headers[this.tenantKey] = tenant.id;
|
|
2427
|
-
}
|
|
2428
|
-
headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
2429
|
-
return headers;
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
ApiInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, deps: [{ token: i1$3.OAuthService }, { token: SessionStateService }, { token: HttpWaitService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2433
|
-
ApiInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, providedIn: 'root' });
|
|
2434
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, decorators: [{
|
|
2435
|
-
type: Injectable,
|
|
2436
|
-
args: [{
|
|
2437
|
-
providedIn: 'root',
|
|
2438
|
-
}]
|
|
2439
|
-
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: SessionStateService }, { type: HttpWaitService }, { type: undefined, decorators: [{
|
|
2440
|
-
type: Inject,
|
|
2441
|
-
args: [TENANT_KEY]
|
|
2442
|
-
}] }]; } });
|
|
2443
|
-
|
|
2444
2335
|
class LocalizationPipe {
|
|
2445
2336
|
constructor(localization) {
|
|
2446
2337
|
this.localization = localization;
|
|
@@ -2598,264 +2489,13 @@ const LocaleProvider = {
|
|
|
2598
2489
|
deps: [LocalizationService],
|
|
2599
2490
|
};
|
|
2600
2491
|
|
|
2601
|
-
const
|
|
2602
|
-
const storageKey = 'passwordFlow';
|
|
2603
|
-
function pipeToLogin(params, injector) {
|
|
2604
|
-
const configState = injector.get(ConfigStateService);
|
|
2605
|
-
const router = injector.get(Router);
|
|
2606
|
-
return pipe(switchMap(() => configState.refreshAppState()), tap(() => {
|
|
2607
|
-
setRememberMe(params.rememberMe);
|
|
2608
|
-
if (params.redirectUrl)
|
|
2609
|
-
router.navigate([params.redirectUrl]);
|
|
2610
|
-
}));
|
|
2611
|
-
}
|
|
2612
|
-
function setTokenResponseToStorage(injector, tokenRes) {
|
|
2613
|
-
const { access_token, refresh_token, scope: grantedScopes, expires_in } = tokenRes;
|
|
2614
|
-
const storage = injector.get(OAuthStorage);
|
|
2615
|
-
storage.setItem('access_token', access_token);
|
|
2616
|
-
storage.setItem('refresh_token', refresh_token);
|
|
2617
|
-
storage.setItem('access_token_stored_at', '' + Date.now());
|
|
2618
|
-
if (grantedScopes) {
|
|
2619
|
-
storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split(' ')));
|
|
2620
|
-
}
|
|
2621
|
-
if (expires_in) {
|
|
2622
|
-
const expiresInMilliSeconds = expires_in * 1000;
|
|
2623
|
-
const now = new Date();
|
|
2624
|
-
const expiresAt = now.getTime() + expiresInMilliSeconds;
|
|
2625
|
-
storage.setItem('expires_at', '' + expiresAt);
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
function setRememberMe(remember) {
|
|
2629
|
-
removeRememberMe();
|
|
2630
|
-
localStorage.setItem(storageKey, 'true');
|
|
2631
|
-
document.cookie = `${cookieKey}=true; path=/${remember ? ' ;expires=Fri, 31 Dec 9999 23:59:59 GMT' : ''}`;
|
|
2632
|
-
}
|
|
2633
|
-
function removeRememberMe() {
|
|
2634
|
-
localStorage.removeItem(storageKey);
|
|
2635
|
-
document.cookie = cookieKey + '= ; path=/; expires = Thu, 01 Jan 1970 00:00:00 GMT';
|
|
2636
|
-
}
|
|
2637
|
-
|
|
2638
|
-
const oAuthStorage = localStorage;
|
|
2639
|
-
class AuthFlowStrategy {
|
|
2640
|
-
constructor(injector) {
|
|
2641
|
-
this.injector = injector;
|
|
2642
|
-
this.catchError = err => {
|
|
2643
|
-
this.httpErrorReporter.reportError(err);
|
|
2644
|
-
return of(null);
|
|
2645
|
-
};
|
|
2646
|
-
this.httpErrorReporter = injector.get(HttpErrorReporterService);
|
|
2647
|
-
this.environment = injector.get(EnvironmentService);
|
|
2648
|
-
this.configState = injector.get(ConfigStateService);
|
|
2649
|
-
this.oAuthService = injector.get(OAuthService);
|
|
2650
|
-
this.sessionState = injector.get(SessionStateService);
|
|
2651
|
-
this.oAuthConfig = this.environment.getEnvironment().oAuthConfig;
|
|
2652
|
-
this.tenantKey = injector.get(TENANT_KEY);
|
|
2653
|
-
this.listenToOauthErrors();
|
|
2654
|
-
}
|
|
2655
|
-
async init() {
|
|
2656
|
-
const shouldClear = shouldStorageClear(this.environment.getEnvironment().oAuthConfig.clientId, oAuthStorage);
|
|
2657
|
-
if (shouldClear)
|
|
2658
|
-
clearOAuthStorage(oAuthStorage);
|
|
2659
|
-
this.oAuthService.configure(this.oAuthConfig);
|
|
2660
|
-
this.oAuthService.events
|
|
2661
|
-
.pipe(filter(event => event.type === 'token_refresh_error'))
|
|
2662
|
-
.subscribe(() => this.navigateToLogin());
|
|
2663
|
-
return this.oAuthService
|
|
2664
|
-
.loadDiscoveryDocument()
|
|
2665
|
-
.then(() => {
|
|
2666
|
-
if (this.oAuthService.hasValidAccessToken() || !this.oAuthService.getRefreshToken()) {
|
|
2667
|
-
return Promise.resolve();
|
|
2668
|
-
}
|
|
2669
|
-
return this.refreshToken();
|
|
2670
|
-
})
|
|
2671
|
-
.catch(this.catchError);
|
|
2672
|
-
}
|
|
2673
|
-
refreshToken() {
|
|
2674
|
-
return this.oAuthService.refreshToken().catch(() => clearOAuthStorage());
|
|
2675
|
-
}
|
|
2676
|
-
listenToOauthErrors() {
|
|
2677
|
-
this.oAuthService.events
|
|
2678
|
-
.pipe(filter(event => event instanceof OAuthErrorEvent), tap(() => clearOAuthStorage()), switchMap(() => this.configState.refreshAppState()))
|
|
2679
|
-
.subscribe();
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
class AuthCodeFlowStrategy extends AuthFlowStrategy {
|
|
2683
|
-
constructor() {
|
|
2684
|
-
super(...arguments);
|
|
2685
|
-
this.isInternalAuth = false;
|
|
2686
|
-
}
|
|
2687
|
-
async init() {
|
|
2688
|
-
return super
|
|
2689
|
-
.init()
|
|
2690
|
-
.then(() => this.oAuthService.tryLogin().catch(noop))
|
|
2691
|
-
.then(() => this.oAuthService.setupAutomaticSilentRefresh({}, 'access_token'));
|
|
2692
|
-
}
|
|
2693
|
-
navigateToLogin(queryParams) {
|
|
2694
|
-
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2695
|
-
}
|
|
2696
|
-
checkIfInternalAuth(queryParams) {
|
|
2697
|
-
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2698
|
-
return false;
|
|
2699
|
-
}
|
|
2700
|
-
logout(queryParams) {
|
|
2701
|
-
return from(this.oAuthService.revokeTokenAndLogout(this.getCultureParams(queryParams)));
|
|
2702
|
-
}
|
|
2703
|
-
login(queryParams) {
|
|
2704
|
-
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
|
|
2705
|
-
return of(null);
|
|
2706
|
-
}
|
|
2707
|
-
getCultureParams(queryParams) {
|
|
2708
|
-
const lang = this.sessionState.getLanguage();
|
|
2709
|
-
const culture = { culture: lang, 'ui-culture': lang };
|
|
2710
|
-
return { ...(lang && culture), ...queryParams };
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
class AuthPasswordFlowStrategy extends AuthFlowStrategy {
|
|
2714
|
-
constructor() {
|
|
2715
|
-
super(...arguments);
|
|
2716
|
-
this.isInternalAuth = true;
|
|
2717
|
-
this.cookieKey = 'rememberMe';
|
|
2718
|
-
this.storageKey = 'passwordFlow';
|
|
2719
|
-
}
|
|
2720
|
-
listenToTokenExpiration() {
|
|
2721
|
-
this.oAuthService.events
|
|
2722
|
-
.pipe(filter(event => event instanceof OAuthInfoEvent &&
|
|
2723
|
-
event.type === 'token_expires' &&
|
|
2724
|
-
event.info === 'access_token'))
|
|
2725
|
-
.subscribe(() => {
|
|
2726
|
-
if (this.oAuthService.getRefreshToken()) {
|
|
2727
|
-
this.refreshToken();
|
|
2728
|
-
}
|
|
2729
|
-
else {
|
|
2730
|
-
this.oAuthService.logOut();
|
|
2731
|
-
removeRememberMe();
|
|
2732
|
-
this.configState.refreshAppState().subscribe();
|
|
2733
|
-
}
|
|
2734
|
-
});
|
|
2735
|
-
}
|
|
2736
|
-
async init() {
|
|
2737
|
-
if (!getCookieValueByName(this.cookieKey) && localStorage.getItem(this.storageKey)) {
|
|
2738
|
-
this.oAuthService.logOut();
|
|
2739
|
-
}
|
|
2740
|
-
return super.init().then(() => this.listenToTokenExpiration());
|
|
2741
|
-
}
|
|
2742
|
-
navigateToLogin(queryParams) {
|
|
2743
|
-
const router = this.injector.get(Router);
|
|
2744
|
-
router.navigate(['/account/login'], { queryParams });
|
|
2745
|
-
}
|
|
2746
|
-
checkIfInternalAuth() {
|
|
2747
|
-
return true;
|
|
2748
|
-
}
|
|
2749
|
-
login(params) {
|
|
2750
|
-
const tenant = this.sessionState.getTenant();
|
|
2751
|
-
return from(this.oAuthService.fetchTokenUsingPasswordFlow(params.username, params.password, new HttpHeaders({ ...(tenant && tenant.id && { [this.tenantKey]: tenant.id }) }))).pipe(this.pipeToLogin(params));
|
|
2752
|
-
}
|
|
2753
|
-
pipeToLogin(params) {
|
|
2754
|
-
const router = this.injector.get(Router);
|
|
2755
|
-
return pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
|
|
2756
|
-
setRememberMe(params.rememberMe);
|
|
2757
|
-
if (params.redirectUrl)
|
|
2758
|
-
router.navigate([params.redirectUrl]);
|
|
2759
|
-
}));
|
|
2760
|
-
}
|
|
2761
|
-
logout(queryParams) {
|
|
2762
|
-
const router = this.injector.get(Router);
|
|
2763
|
-
return from(this.oAuthService.revokeTokenAndLogout(queryParams)).pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
|
|
2764
|
-
router.navigateByUrl('/');
|
|
2765
|
-
removeRememberMe();
|
|
2766
|
-
}));
|
|
2767
|
-
}
|
|
2768
|
-
refreshToken() {
|
|
2769
|
-
return this.oAuthService.refreshToken().catch(() => {
|
|
2770
|
-
clearOAuthStorage();
|
|
2771
|
-
removeRememberMe();
|
|
2772
|
-
});
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
|
-
const AUTH_FLOW_STRATEGY = {
|
|
2776
|
-
Code(injector) {
|
|
2777
|
-
return new AuthCodeFlowStrategy(injector);
|
|
2778
|
-
},
|
|
2779
|
-
Password(injector) {
|
|
2780
|
-
return new AuthPasswordFlowStrategy(injector);
|
|
2781
|
-
},
|
|
2782
|
-
};
|
|
2783
|
-
function clearOAuthStorage(storage = oAuthStorage) {
|
|
2784
|
-
const keys = [
|
|
2785
|
-
'access_token',
|
|
2786
|
-
'id_token',
|
|
2787
|
-
'refresh_token',
|
|
2788
|
-
'nonce',
|
|
2789
|
-
'PKCE_verifier',
|
|
2790
|
-
'expires_at',
|
|
2791
|
-
'id_token_claims_obj',
|
|
2792
|
-
'id_token_expires_at',
|
|
2793
|
-
'id_token_stored_at',
|
|
2794
|
-
'access_token_stored_at',
|
|
2795
|
-
'granted_scopes',
|
|
2796
|
-
'session_state',
|
|
2797
|
-
];
|
|
2798
|
-
keys.forEach(key => storage.removeItem(key));
|
|
2799
|
-
}
|
|
2800
|
-
function shouldStorageClear(clientId, storage) {
|
|
2801
|
-
const key = 'abpOAuthClientId';
|
|
2802
|
-
if (!storage.getItem(key)) {
|
|
2803
|
-
storage.setItem(key, clientId);
|
|
2804
|
-
return false;
|
|
2805
|
-
}
|
|
2806
|
-
const shouldClear = storage.getItem(key) !== clientId;
|
|
2807
|
-
if (shouldClear)
|
|
2808
|
-
storage.setItem(key, clientId);
|
|
2809
|
-
return shouldClear;
|
|
2810
|
-
}
|
|
2811
|
-
function getCookieValueByName(name) {
|
|
2812
|
-
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
2813
|
-
return match ? match[2] : '';
|
|
2814
|
-
}
|
|
2492
|
+
const TENANT_KEY = new InjectionToken('TENANT_KEY');
|
|
2815
2493
|
|
|
2816
2494
|
Date.prototype.toLocalISOString = function () {
|
|
2817
2495
|
const timezoneOffset = this.getTimezoneOffset();
|
|
2818
2496
|
return new Date(this.getTime() - timezoneOffset * 60000).toISOString();
|
|
2819
2497
|
};
|
|
2820
2498
|
|
|
2821
|
-
class AuthService {
|
|
2822
|
-
constructor(injector) {
|
|
2823
|
-
this.injector = injector;
|
|
2824
|
-
}
|
|
2825
|
-
get isInternalAuth() {
|
|
2826
|
-
return this.strategy.isInternalAuth;
|
|
2827
|
-
}
|
|
2828
|
-
async init() {
|
|
2829
|
-
const environmentService = this.injector.get(EnvironmentService);
|
|
2830
|
-
return environmentService
|
|
2831
|
-
.getEnvironment$()
|
|
2832
|
-
.pipe(map(env => env?.oAuthConfig), filter(oAuthConfig => !!oAuthConfig), tap(oAuthConfig => {
|
|
2833
|
-
this.strategy =
|
|
2834
|
-
oAuthConfig.responseType === 'code'
|
|
2835
|
-
? AUTH_FLOW_STRATEGY.Code(this.injector)
|
|
2836
|
-
: AUTH_FLOW_STRATEGY.Password(this.injector);
|
|
2837
|
-
}), switchMap(() => from(this.strategy.init())), take(1))
|
|
2838
|
-
.toPromise();
|
|
2839
|
-
}
|
|
2840
|
-
logout(queryParams) {
|
|
2841
|
-
return this.strategy.logout(queryParams);
|
|
2842
|
-
}
|
|
2843
|
-
navigateToLogin(queryParams) {
|
|
2844
|
-
this.strategy.navigateToLogin(queryParams);
|
|
2845
|
-
}
|
|
2846
|
-
login(params) {
|
|
2847
|
-
return this.strategy.login(params);
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2851
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
2852
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, decorators: [{
|
|
2853
|
-
type: Injectable,
|
|
2854
|
-
args: [{
|
|
2855
|
-
providedIn: 'root',
|
|
2856
|
-
}]
|
|
2857
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2858
|
-
|
|
2859
2499
|
const APP_INIT_ERROR_HANDLERS = new InjectionToken('APP_INIT_ERROR_HANDLERS');
|
|
2860
2500
|
|
|
2861
2501
|
function getRemoteEnv(injector, environment) {
|
|
@@ -3020,6 +2660,8 @@ function replaceTenantNameWithinEnvironment(injector, tenancyName, placeholder =
|
|
|
3020
2660
|
return environmentService.setState(environment);
|
|
3021
2661
|
}
|
|
3022
2662
|
|
|
2663
|
+
const CHECK_AUTHENTICATION_STATE_FN_KEY = new InjectionToken('CHECK_AUTHENTICATION_STATE_FN_KEY');
|
|
2664
|
+
|
|
3023
2665
|
function getInitialData(injector) {
|
|
3024
2666
|
const fn = async () => {
|
|
3025
2667
|
const environmentService = injector.get(EnvironmentService);
|
|
@@ -3028,12 +2670,16 @@ function getInitialData(injector) {
|
|
|
3028
2670
|
environmentService.setState(options.environment);
|
|
3029
2671
|
await getRemoteEnv(injector, options.environment);
|
|
3030
2672
|
await parseTenantFromUrl(injector);
|
|
3031
|
-
|
|
2673
|
+
const authService = injector.get(AuthService, undefined, { optional: true });
|
|
2674
|
+
const checkAuthenticationState = injector.get(CHECK_AUTHENTICATION_STATE_FN_KEY, noop, {
|
|
2675
|
+
optional: true,
|
|
2676
|
+
});
|
|
2677
|
+
if (authService) {
|
|
2678
|
+
await authService.init();
|
|
2679
|
+
}
|
|
3032
2680
|
if (options.skipGetAppConfiguration)
|
|
3033
2681
|
return;
|
|
3034
|
-
|
|
3035
|
-
.refreshAppState()
|
|
3036
|
-
.pipe(tap(() => checkAccessToken(injector)), tap(() => {
|
|
2682
|
+
const result$ = configState.refreshAppState().pipe(tap(() => checkAuthenticationState(injector)), tap(() => {
|
|
3037
2683
|
const currentTenant = configState.getOne('currentTenant');
|
|
3038
2684
|
injector.get(SessionStateService).setTenant(currentTenant);
|
|
3039
2685
|
}), catchError(error => {
|
|
@@ -3042,18 +2688,11 @@ function getInitialData(injector) {
|
|
|
3042
2688
|
appInitErrorHandlers.forEach(func => func(error));
|
|
3043
2689
|
}
|
|
3044
2690
|
return throwError(error);
|
|
3045
|
-
}))
|
|
3046
|
-
|
|
2691
|
+
}));
|
|
2692
|
+
await lastValueFrom(result$);
|
|
3047
2693
|
};
|
|
3048
2694
|
return fn;
|
|
3049
2695
|
}
|
|
3050
|
-
function checkAccessToken(injector) {
|
|
3051
|
-
const configState = injector.get(ConfigStateService);
|
|
3052
|
-
const oAuth = injector.get(OAuthService);
|
|
3053
|
-
if (oAuth.hasValidAccessToken() && !configState.getDeep('currentUser.id')) {
|
|
3054
|
-
clearOAuthStorage();
|
|
3055
|
-
}
|
|
3056
|
-
}
|
|
3057
2696
|
function localeInitializer(injector) {
|
|
3058
2697
|
const fn = () => {
|
|
3059
2698
|
const sessionState = injector.get(SessionStateService);
|
|
@@ -3183,6 +2822,25 @@ function generatePassword(length = 8) {
|
|
|
3183
2822
|
return password.sort(() => 0.5 - Math.random()).join('');
|
|
3184
2823
|
}
|
|
3185
2824
|
|
|
2825
|
+
function getPathName(url) {
|
|
2826
|
+
const { pathname } = new URL(url, window.location.origin);
|
|
2827
|
+
return pathname;
|
|
2828
|
+
}
|
|
2829
|
+
class WebHttpUrlEncodingCodec {
|
|
2830
|
+
encodeKey(k) {
|
|
2831
|
+
return encodeURIComponent(k);
|
|
2832
|
+
}
|
|
2833
|
+
encodeValue(v) {
|
|
2834
|
+
return encodeURIComponent(v);
|
|
2835
|
+
}
|
|
2836
|
+
decodeKey(k) {
|
|
2837
|
+
return decodeURIComponent(k);
|
|
2838
|
+
}
|
|
2839
|
+
decodeValue(v) {
|
|
2840
|
+
return decodeURIComponent(v);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
|
|
3186
2844
|
class CrossOriginStrategy {
|
|
3187
2845
|
constructor(crossorigin, integrity) {
|
|
3188
2846
|
this.crossorigin = crossorigin;
|
|
@@ -3302,6 +2960,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3302
2960
|
args: [{ providedIn: 'root' }]
|
|
3303
2961
|
}] });
|
|
3304
2962
|
|
|
2963
|
+
const LOADER_DELAY = new InjectionToken('LOADER_DELAY');
|
|
2964
|
+
|
|
2965
|
+
class HttpWaitService {
|
|
2966
|
+
constructor(injector) {
|
|
2967
|
+
this.store = new InternalStore({
|
|
2968
|
+
requests: [],
|
|
2969
|
+
filteredRequests: [],
|
|
2970
|
+
});
|
|
2971
|
+
this.destroy$ = new Subject();
|
|
2972
|
+
this.delay = injector.get(LOADER_DELAY, 500);
|
|
2973
|
+
}
|
|
2974
|
+
getLoading() {
|
|
2975
|
+
return !!this.applyFilter(this.store.state.requests).length;
|
|
2976
|
+
}
|
|
2977
|
+
getLoading$() {
|
|
2978
|
+
return this.store
|
|
2979
|
+
.sliceState(({ requests }) => requests)
|
|
2980
|
+
.pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
|
|
2981
|
+
? this.delay === 0
|
|
2982
|
+
? of(true)
|
|
2983
|
+
: timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
|
|
2984
|
+
: of(false)), tap(() => this.destroy$.next()));
|
|
2985
|
+
}
|
|
2986
|
+
updateLoading$() {
|
|
2987
|
+
return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
|
|
2988
|
+
}
|
|
2989
|
+
clearLoading() {
|
|
2990
|
+
this.store.patch({ requests: [] });
|
|
2991
|
+
}
|
|
2992
|
+
addRequest(request) {
|
|
2993
|
+
this.store.patch({ requests: [...this.store.state.requests, request] });
|
|
2994
|
+
}
|
|
2995
|
+
deleteRequest(request) {
|
|
2996
|
+
const requests = this.store.state.requests.filter(r => r !== request);
|
|
2997
|
+
this.store.patch({ requests });
|
|
2998
|
+
}
|
|
2999
|
+
addFilter(request) {
|
|
3000
|
+
const requests = Array.isArray(request) ? request : [request];
|
|
3001
|
+
const filteredRequests = [
|
|
3002
|
+
...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
|
|
3003
|
+
...requests,
|
|
3004
|
+
];
|
|
3005
|
+
this.store.patch({ filteredRequests });
|
|
3006
|
+
}
|
|
3007
|
+
removeFilter(request) {
|
|
3008
|
+
const requests = Array.isArray(request) ? request : [request];
|
|
3009
|
+
const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
|
|
3010
|
+
this.store.patch({ filteredRequests });
|
|
3011
|
+
}
|
|
3012
|
+
applyFilter(requests) {
|
|
3013
|
+
const { filteredRequests } = this.store.state;
|
|
3014
|
+
return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
|
|
3015
|
+
}
|
|
3016
|
+
isSameRequest(filteredRequest, request) {
|
|
3017
|
+
const { method, endpoint } = filteredRequest;
|
|
3018
|
+
return endpoint === request.endpoint && method === request.method;
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
HttpWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3022
|
+
HttpWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, providedIn: 'root' });
|
|
3023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, decorators: [{
|
|
3024
|
+
type: Injectable,
|
|
3025
|
+
args: [{
|
|
3026
|
+
providedIn: 'root',
|
|
3027
|
+
}]
|
|
3028
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
3029
|
+
|
|
3305
3030
|
class ResourceWaitService {
|
|
3306
3031
|
constructor() {
|
|
3307
3032
|
this.store = new InternalStore({ resources: new Set() });
|
|
@@ -3530,19 +3255,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3530
3255
|
}]
|
|
3531
3256
|
}] });
|
|
3532
3257
|
|
|
3533
|
-
class TimeoutLimitedOAuthService extends OAuthService {
|
|
3534
|
-
calcTimeout(storedAt, expiration) {
|
|
3535
|
-
const result = super.calcTimeout(storedAt, expiration);
|
|
3536
|
-
const MAX_TIMEOUT_DURATION = 2147483647;
|
|
3537
|
-
return result < MAX_TIMEOUT_DURATION ? result : MAX_TIMEOUT_DURATION - 1;
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
|
-
TimeoutLimitedOAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
3541
|
-
TimeoutLimitedOAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService });
|
|
3542
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService, decorators: [{
|
|
3543
|
-
type: Injectable
|
|
3544
|
-
}] });
|
|
3545
|
-
|
|
3546
3258
|
class ShortDateTimePipe extends DatePipe {
|
|
3547
3259
|
constructor(configStateService, locale, defaultTimezone) {
|
|
3548
3260
|
super(locale, defaultTimezone);
|
|
@@ -3632,9 +3344,6 @@ const IncludeLocalizationResourcesProvider = {
|
|
|
3632
3344
|
useValue: false,
|
|
3633
3345
|
};
|
|
3634
3346
|
|
|
3635
|
-
function storageFactory() {
|
|
3636
|
-
return oAuthStorage;
|
|
3637
|
-
}
|
|
3638
3347
|
/**
|
|
3639
3348
|
* BaseCoreModule is the module that holds
|
|
3640
3349
|
* all imports, declarations, exports, and entryComponents
|
|
@@ -3660,8 +3369,7 @@ BaseCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
3660
3369
|
ToInjectorPipe,
|
|
3661
3370
|
ShortDateTimePipe,
|
|
3662
3371
|
ShortTimePipe,
|
|
3663
|
-
ShortDatePipe], imports: [
|
|
3664
|
-
CommonModule,
|
|
3372
|
+
ShortDatePipe], imports: [CommonModule,
|
|
3665
3373
|
HttpClientModule,
|
|
3666
3374
|
FormsModule,
|
|
3667
3375
|
ReactiveFormsModule,
|
|
@@ -3689,8 +3397,7 @@ BaseCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
3689
3397
|
ShortDateTimePipe,
|
|
3690
3398
|
ShortTimePipe,
|
|
3691
3399
|
ShortDatePipe] });
|
|
3692
|
-
BaseCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BaseCoreModule, providers: [LocalizationPipe], imports: [
|
|
3693
|
-
CommonModule,
|
|
3400
|
+
BaseCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BaseCoreModule, providers: [LocalizationPipe], imports: [CommonModule,
|
|
3694
3401
|
HttpClientModule,
|
|
3695
3402
|
FormsModule,
|
|
3696
3403
|
ReactiveFormsModule,
|
|
@@ -3730,7 +3437,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3730
3437
|
ShortDatePipe,
|
|
3731
3438
|
],
|
|
3732
3439
|
imports: [
|
|
3733
|
-
OAuthModule,
|
|
3734
3440
|
CommonModule,
|
|
3735
3441
|
HttpClientModule,
|
|
3736
3442
|
FormsModule,
|
|
@@ -3767,11 +3473,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3767
3473
|
class RootCoreModule {
|
|
3768
3474
|
}
|
|
3769
3475
|
RootCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3770
|
-
RootCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule, LocalizationModule,
|
|
3771
|
-
OAuthModule, i1.HttpClientXsrfModule], exports: [BaseCoreModule, LocalizationModule] });
|
|
3476
|
+
RootCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule, LocalizationModule, i1.HttpClientXsrfModule], exports: [BaseCoreModule, LocalizationModule] });
|
|
3772
3477
|
RootCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule,
|
|
3773
3478
|
LocalizationModule,
|
|
3774
|
-
OAuthModule,
|
|
3775
3479
|
HttpClientXsrfModule.withOptions({
|
|
3776
3480
|
cookieName: 'XSRF-TOKEN',
|
|
3777
3481
|
headerName: 'RequestVerificationToken',
|
|
@@ -3783,7 +3487,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3783
3487
|
imports: [
|
|
3784
3488
|
BaseCoreModule,
|
|
3785
3489
|
LocalizationModule,
|
|
3786
|
-
OAuthModule,
|
|
3787
3490
|
HttpClientXsrfModule.withOptions({
|
|
3788
3491
|
cookieName: 'XSRF-TOKEN',
|
|
3789
3492
|
headerName: 'RequestVerificationToken',
|
|
@@ -3799,7 +3502,6 @@ class CoreModule {
|
|
|
3799
3502
|
return {
|
|
3800
3503
|
ngModule: RootCoreModule,
|
|
3801
3504
|
providers: [
|
|
3802
|
-
OAuthModule.forRoot().providers,
|
|
3803
3505
|
LocaleProvider,
|
|
3804
3506
|
CookieLanguageProvider,
|
|
3805
3507
|
{
|
|
@@ -3811,17 +3513,6 @@ class CoreModule {
|
|
|
3811
3513
|
useFactory: coreOptionsFactory,
|
|
3812
3514
|
deps: ['CORE_OPTIONS'],
|
|
3813
3515
|
},
|
|
3814
|
-
{
|
|
3815
|
-
provide: HTTP_INTERCEPTORS,
|
|
3816
|
-
useExisting: ApiInterceptor,
|
|
3817
|
-
multi: true,
|
|
3818
|
-
},
|
|
3819
|
-
{
|
|
3820
|
-
provide: APP_INITIALIZER,
|
|
3821
|
-
multi: true,
|
|
3822
|
-
deps: [OAuthConfigurationHandler],
|
|
3823
|
-
useFactory: noop,
|
|
3824
|
-
},
|
|
3825
3516
|
{
|
|
3826
3517
|
provide: APP_INITIALIZER,
|
|
3827
3518
|
multi: true,
|
|
@@ -3846,8 +3537,6 @@ class CoreModule {
|
|
|
3846
3537
|
deps: [RoutesHandler],
|
|
3847
3538
|
useFactory: noop,
|
|
3848
3539
|
},
|
|
3849
|
-
{ provide: OAuthStorage, useFactory: storageFactory },
|
|
3850
|
-
{ provide: OAuthService, useClass: TimeoutLimitedOAuthService },
|
|
3851
3540
|
{ provide: TENANT_KEY, useValue: options.tenantKey || '__tenant' },
|
|
3852
3541
|
{
|
|
3853
3542
|
provide: LOCALIZATIONS,
|
|
@@ -3855,7 +3544,7 @@ class CoreModule {
|
|
|
3855
3544
|
useValue: localizationContributor(options.localizations),
|
|
3856
3545
|
deps: [LocalizationService],
|
|
3857
3546
|
},
|
|
3858
|
-
IncludeLocalizationResourcesProvider
|
|
3547
|
+
IncludeLocalizationResourcesProvider,
|
|
3859
3548
|
],
|
|
3860
3549
|
};
|
|
3861
3550
|
}
|
|
@@ -3884,29 +3573,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
3884
3573
|
}]
|
|
3885
3574
|
}] });
|
|
3886
3575
|
|
|
3887
|
-
class AuthGuard {
|
|
3888
|
-
constructor(oauthService, authService) {
|
|
3889
|
-
this.oauthService = oauthService;
|
|
3890
|
-
this.authService = authService;
|
|
3891
|
-
}
|
|
3892
|
-
canActivate() {
|
|
3893
|
-
const hasValidAccessToken = this.oauthService.hasValidAccessToken();
|
|
3894
|
-
if (hasValidAccessToken) {
|
|
3895
|
-
return true;
|
|
3896
|
-
}
|
|
3897
|
-
this.authService.navigateToLogin();
|
|
3898
|
-
return false;
|
|
3899
|
-
}
|
|
3900
|
-
}
|
|
3901
|
-
AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, deps: [{ token: i1$3.OAuthService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3902
|
-
AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, providedIn: 'root' });
|
|
3903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, decorators: [{
|
|
3904
|
-
type: Injectable,
|
|
3905
|
-
args: [{
|
|
3906
|
-
providedIn: 'root',
|
|
3907
|
-
}]
|
|
3908
|
-
}], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: AuthService }]; } });
|
|
3909
|
-
|
|
3910
3576
|
class PermissionGuard {
|
|
3911
3577
|
constructor(router, routesService, permissionService, httpErrorReporter) {
|
|
3912
3578
|
this.router = router;
|
|
@@ -4359,15 +4025,11 @@ const PROJECTION_STRATEGY = {
|
|
|
4359
4025
|
},
|
|
4360
4026
|
};
|
|
4361
4027
|
|
|
4362
|
-
const NAVIGATE_TO_MANAGE_PROFILE = new InjectionToken('NAVIGATE_TO_MANAGE_PROFILE'
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
window.open(`${environment.getEnvironment().oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`, '_self');
|
|
4368
|
-
};
|
|
4369
|
-
},
|
|
4370
|
-
});
|
|
4028
|
+
const NAVIGATE_TO_MANAGE_PROFILE = new InjectionToken('NAVIGATE_TO_MANAGE_PROFILE');
|
|
4029
|
+
|
|
4030
|
+
const PIPE_TO_LOGIN_FN_KEY = new InjectionToken('PIPE_TO_LOGIN_FN_KEY');
|
|
4031
|
+
|
|
4032
|
+
const SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY = new InjectionToken('SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY');
|
|
4371
4033
|
|
|
4372
4034
|
function validateMinAge({ age = 18 } = {}) {
|
|
4373
4035
|
return (control) => {
|
|
@@ -4489,11 +4151,32 @@ const AbpValidators = {
|
|
|
4489
4151
|
username: validateUsername,
|
|
4490
4152
|
};
|
|
4491
4153
|
|
|
4154
|
+
class ApiInterceptor {
|
|
4155
|
+
constructor(httpWaitService) {
|
|
4156
|
+
this.httpWaitService = httpWaitService;
|
|
4157
|
+
}
|
|
4158
|
+
getAdditionalHeaders(existingHeaders) {
|
|
4159
|
+
return existingHeaders;
|
|
4160
|
+
}
|
|
4161
|
+
intercept(request, next) {
|
|
4162
|
+
this.httpWaitService.addRequest(request);
|
|
4163
|
+
return next.handle(request).pipe(finalize(() => this.httpWaitService.deleteRequest(request)));
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
ApiInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, deps: [{ token: HttpWaitService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4167
|
+
ApiInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, providedIn: 'root' });
|
|
4168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, decorators: [{
|
|
4169
|
+
type: Injectable,
|
|
4170
|
+
args: [{
|
|
4171
|
+
providedIn: 'root',
|
|
4172
|
+
}]
|
|
4173
|
+
}], ctorParameters: function () { return [{ type: HttpWaitService }]; } });
|
|
4174
|
+
|
|
4492
4175
|
// export * from './lib/handlers';
|
|
4493
4176
|
|
|
4494
4177
|
/**
|
|
4495
4178
|
* Generated bundle index. Do not edit.
|
|
4496
4179
|
*/
|
|
4497
4180
|
|
|
4498
|
-
export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy,
|
|
4181
|
+
export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, coreOptionsFactory, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
|
|
4499
4182
|
//# sourceMappingURL=abp-ng.core.mjs.map
|