intelica-library-ui 0.1.123 → 0.1.124
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.
|
@@ -424,10 +424,20 @@ const ErrorInterceptor = (req, next) => {
|
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
426
|
|
|
427
|
+
function GetCookieAttributes(environment) {
|
|
428
|
+
const domain = window.location.hostname
|
|
429
|
+
.split(".")
|
|
430
|
+
.slice(environment == "main" ? -2 : -3)
|
|
431
|
+
.join(".");
|
|
432
|
+
const secure = !domain.includes("localhost");
|
|
433
|
+
return { domain: domain, path: "/", secure: secure };
|
|
434
|
+
}
|
|
435
|
+
|
|
427
436
|
const RefreshTokenInterceptor = (req, next) => {
|
|
428
437
|
const configService = inject(ConfigService);
|
|
429
438
|
const httpClient = inject(HttpClient);
|
|
430
439
|
const commonFeatureFlagService = inject(GlobalFeatureFlagService);
|
|
440
|
+
const cookieAttributesGeneral = GetCookieAttributes(configService.environment?.environment ?? "");
|
|
431
441
|
let _request = req.clone();
|
|
432
442
|
let authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
|
|
433
443
|
let path = `${configService.environment?.authenticationPath ?? ""}/Authenticate/ValidateToken`;
|
|
@@ -446,20 +456,20 @@ const RefreshTokenInterceptor = (req, next) => {
|
|
|
446
456
|
if (!req.url.includes("ValidateToken") && !req.url.includes("environment.json") && !req.url.includes("GetAuthenticationFromCache"))
|
|
447
457
|
return from(httpClient.post(path, validateTokenQuery)).pipe(switchMap((response) => {
|
|
448
458
|
if (response.expired) {
|
|
449
|
-
Cookies.remove("token",
|
|
450
|
-
Cookies.remove("refreshToken",
|
|
451
|
-
Cookies.remove("data",
|
|
452
|
-
Cookies.remove("businessUserClientGroupID",
|
|
453
|
-
Cookies.remove("defaultClientID",
|
|
454
|
-
Cookies.remove("defaultClientGroupID",
|
|
455
|
-
Cookies.remove(authenticationClientID,
|
|
459
|
+
Cookies.remove("token", cookieAttributesGeneral);
|
|
460
|
+
Cookies.remove("refreshToken", cookieAttributesGeneral);
|
|
461
|
+
Cookies.remove("data", cookieAttributesGeneral);
|
|
462
|
+
Cookies.remove("businessUserClientGroupID", cookieAttributesGeneral);
|
|
463
|
+
Cookies.remove("defaultClientID", cookieAttributesGeneral);
|
|
464
|
+
Cookies.remove("defaultClientGroupID", cookieAttributesGeneral);
|
|
465
|
+
Cookies.remove(authenticationClientID, cookieAttributesGeneral);
|
|
456
466
|
window.location.href = authenticationLocation;
|
|
457
467
|
return next(_request);
|
|
458
468
|
}
|
|
459
469
|
if (response.unauthorized)
|
|
460
470
|
window.location.href = window.location.origin;
|
|
461
471
|
if (response.newToken != "")
|
|
462
|
-
setCookie("token", response.newToken,
|
|
472
|
+
setCookie("token", response.newToken, cookieAttributesGeneral);
|
|
463
473
|
return next(_request);
|
|
464
474
|
}));
|
|
465
475
|
else
|
|
@@ -4143,15 +4153,6 @@ function EmailInputValidation(event) {
|
|
|
4143
4153
|
}
|
|
4144
4154
|
}
|
|
4145
4155
|
|
|
4146
|
-
function GetCookieAttributes(environment) {
|
|
4147
|
-
const domain = window.location.hostname
|
|
4148
|
-
.split(".")
|
|
4149
|
-
.slice(environment == "main" ? -2 : -3)
|
|
4150
|
-
.join(".");
|
|
4151
|
-
const secure = !domain.includes("localhost");
|
|
4152
|
-
return { domain: domain, path: "/", secure: secure };
|
|
4153
|
-
}
|
|
4154
|
-
|
|
4155
4156
|
const IntelicaTheme = definePreset(Aura, {
|
|
4156
4157
|
primitive: {
|
|
4157
4158
|
blue: {
|