@dsivd/prestations-ng 15.2.3-beta5 → 15.2.3-beta8
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/dsivd-prestations-ng-v15.2.3-beta8.tgz +0 -0
- package/esm2020/sdk-redirect/iam-expired-interceptor.service.mjs +19 -24
- package/esm2020/sdk-redirect/redirect.component.mjs +2 -2
- package/fesm2015/dsivd-prestations-ng.mjs +19 -24
- package/fesm2015/dsivd-prestations-ng.mjs.map +1 -1
- package/fesm2020/dsivd-prestations-ng.mjs +19 -24
- package/fesm2020/dsivd-prestations-ng.mjs.map +1 -1
- package/package.json +1 -1
- package/sdk-redirect/iam-expired-interceptor.service.d.ts +2 -2
- package/dsivd-prestations-ng-v15.2.3-beta5.tgz +0 -0
|
@@ -32,35 +32,30 @@ import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
|
32
32
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
33
33
|
const IAM_SESSION_EXPIRED_HEADER = 'iam-session-expired';
|
|
34
34
|
const CYBER_LOGIN_PATH = '/100018/login';
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const isRedirectionToIamACV = (event) => {
|
|
39
|
-
const isRedirection = event.status === 302 /* Found */;
|
|
40
|
-
const location = event.headers.get('Location');
|
|
41
|
-
return (isRedirection &&
|
|
42
|
-
(location?.includes(PORTAIL_IAM_ACV_EXTRA_PATH) ||
|
|
43
|
-
location?.includes(PORTAIL_IAM_ACV_INTRA_PATH)));
|
|
35
|
+
const ACV_LOGIN_PATH = '/iamlogin';
|
|
36
|
+
const isIamExpiredHeader = (event) => {
|
|
37
|
+
return !!event.headers.get(IAM_SESSION_EXPIRED_HEADER);
|
|
44
38
|
};
|
|
45
|
-
const
|
|
39
|
+
const isRedirectionToLogin = (event) => {
|
|
46
40
|
const isRedirection = event.status === 302 /* Found */;
|
|
47
|
-
const
|
|
48
|
-
|
|
41
|
+
const locationHeader = event.headers.get('Location');
|
|
42
|
+
const isLocationCyberLogin = locationHeader?.includes(CYBER_LOGIN_PATH);
|
|
43
|
+
const isLocationAcvLogin = locationHeader?.includes(ACV_LOGIN_PATH);
|
|
44
|
+
return isRedirection && (isLocationCyberLogin || isLocationAcvLogin);
|
|
49
45
|
};
|
|
50
46
|
class IamExpiredInterceptorService {
|
|
51
47
|
constructor() {
|
|
52
|
-
this.
|
|
48
|
+
this._isIamSessionExpired = new Subject();
|
|
53
49
|
}
|
|
54
|
-
get
|
|
55
|
-
return this.
|
|
50
|
+
get isIamSessionExpired() {
|
|
51
|
+
return this._isIamSessionExpired.asObservable();
|
|
56
52
|
}
|
|
57
53
|
intercept(req, next) {
|
|
58
54
|
return next.handle(req).pipe(map(event => {
|
|
59
55
|
if (event instanceof HttpResponse) {
|
|
60
56
|
if (isIamExpiredHeader(event) ||
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this._iamExpirationHeaderPresence.next(true);
|
|
57
|
+
isRedirectionToLogin(event)) {
|
|
58
|
+
this._isIamSessionExpired.next(true);
|
|
64
59
|
}
|
|
65
60
|
}
|
|
66
61
|
return event;
|
|
@@ -68,11 +63,11 @@ class IamExpiredInterceptorService {
|
|
|
68
63
|
}
|
|
69
64
|
handleError(err) {
|
|
70
65
|
if (err instanceof HttpErrorResponse) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
const isStatusOk = err.status === 200 /* Ok */;
|
|
67
|
+
const isUrlCyberLogin = err.url.includes(CYBER_LOGIN_PATH);
|
|
68
|
+
const isUrlAcvLogin = err.url.includes(ACV_LOGIN_PATH);
|
|
69
|
+
if (isStatusOk && (isUrlCyberLogin || isUrlAcvLogin)) {
|
|
70
|
+
this._isIamSessionExpired.next(true);
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
return throwError(err);
|
|
@@ -9937,7 +9932,7 @@ class RedirectComponent {
|
|
|
9937
9932
|
this.modalHeaderText = 'Information';
|
|
9938
9933
|
this.modalBodyText = `<p>Votre session a expiré.</p>
|
|
9939
9934
|
<p>Vous pouvez vous connecter à nouveau pour continuer à utiliser nos services.</p>`;
|
|
9940
|
-
this.iamInterceptor.
|
|
9935
|
+
this.iamInterceptor.isIamSessionExpired
|
|
9941
9936
|
.pipe(first())
|
|
9942
9937
|
.subscribe(() => this.showModal());
|
|
9943
9938
|
}
|