@indigina/kendo 2.0.33 → 2.0.34
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.
|
@@ -10,12 +10,12 @@ import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
|
10
10
|
import * as i3 from '@progress/kendo-angular-upload';
|
|
11
11
|
import { UploadsModule } from '@progress/kendo-angular-upload';
|
|
12
12
|
import * as i2$2 from '@angular/common/http';
|
|
13
|
-
import { HttpClientModule, HttpStatusCode, HttpContextToken, HttpClient, HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
13
|
+
import { HttpClientModule, HttpStatusCode, HttpContextToken, HttpErrorResponse, HttpClient, HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
14
14
|
import * as i2$1 from '@progress/kendo-angular-inputs';
|
|
15
15
|
import { InputsModule } from '@progress/kendo-angular-inputs';
|
|
16
16
|
import * as i3$1 from '@progress/kendo-angular-label';
|
|
17
17
|
import { LabelModule } from '@progress/kendo-angular-label';
|
|
18
|
-
import { BehaviorSubject, Subject, of, throwError, map as map$1, from, tap as tap$1, switchMap, takeUntil } from 'rxjs';
|
|
18
|
+
import { BehaviorSubject, Subject, of, throwError, map as map$1, from, tap as tap$1, switchMap, takeUntil, catchError as catchError$1 } from 'rxjs';
|
|
19
19
|
import { map, mergeMap, debounceTime, catchError, tap, filter, take, finalize } from 'rxjs/operators';
|
|
20
20
|
import { toODataString, distinct, filterBy } from '@progress/kendo-data-query';
|
|
21
21
|
import * as i1$1 from 'ngx-toastr';
|
|
@@ -4151,12 +4151,36 @@ const SKIP_AUTH_TOKEN = new HttpContextToken(() => false);
|
|
|
4151
4151
|
class AuthHeadersInterceptor {
|
|
4152
4152
|
constructor() {
|
|
4153
4153
|
this.msalService = inject(MsalService);
|
|
4154
|
+
this.settingsService = inject(SettingsService);
|
|
4155
|
+
this.isRedirecting = false;
|
|
4154
4156
|
}
|
|
4155
4157
|
intercept(req, next) {
|
|
4156
4158
|
if (req.context.get(SKIP_AUTH_TOKEN)) {
|
|
4157
4159
|
return next.handle(req);
|
|
4158
4160
|
}
|
|
4159
|
-
return this.msalService.acquireTokenSilent({ scopes: [] }).pipe(switchMap((result) => next.handle(this.addAuthHeader(req, result.idToken))))
|
|
4161
|
+
return this.msalService.acquireTokenSilent({ scopes: [] }).pipe(switchMap((result) => next.handle(this.addAuthHeader(req, result.idToken))), catchError$1((error) => {
|
|
4162
|
+
if (this.requiresLogin(error)) {
|
|
4163
|
+
this.redirectToLogin();
|
|
4164
|
+
}
|
|
4165
|
+
return throwError(() => error);
|
|
4166
|
+
}));
|
|
4167
|
+
}
|
|
4168
|
+
requiresLogin(error) {
|
|
4169
|
+
return error instanceof InteractionRequiredAuthError ||
|
|
4170
|
+
error instanceof HttpErrorResponse &&
|
|
4171
|
+
error.status === HttpStatusCode.Unauthorized;
|
|
4172
|
+
}
|
|
4173
|
+
redirectToLogin() {
|
|
4174
|
+
if (this.isRedirecting) {
|
|
4175
|
+
return;
|
|
4176
|
+
}
|
|
4177
|
+
this.isRedirecting = true;
|
|
4178
|
+
this.settingsService.putCurrentCallbackPath();
|
|
4179
|
+
this.msalService.loginRedirect().subscribe({
|
|
4180
|
+
error: () => {
|
|
4181
|
+
this.isRedirecting = false;
|
|
4182
|
+
},
|
|
4183
|
+
});
|
|
4160
4184
|
}
|
|
4161
4185
|
addAuthHeader(req, token) {
|
|
4162
4186
|
return req.clone({
|