@dsivd/prestations-ng 15.2.3-beta6 → 15.2.3-beta9
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-beta9.tgz +0 -0
- package/esm2020/sdk-redirect/iam-expired-interceptor.service.mjs +21 -25
- package/esm2020/sdk-redirect/redirect.component.mjs +8 -8
- package/fesm2015/dsivd-prestations-ng.mjs +27 -31
- package/fesm2015/dsivd-prestations-ng.mjs.map +1 -1
- package/fesm2020/dsivd-prestations-ng.mjs +27 -31
- 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/sdk-redirect/redirect.component.d.ts +1 -2
- package/dsivd-prestations-ng-v15.2.3-beta6.tgz +0 -0
|
@@ -32,36 +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
|
-
console.log('event', event);
|
|
60
55
|
if (event instanceof HttpResponse) {
|
|
61
56
|
if (isIamExpiredHeader(event) ||
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this._iamExpirationHeaderPresence.next(true);
|
|
57
|
+
isRedirectionToLogin(event)) {
|
|
58
|
+
this._isIamSessionExpired.next(true);
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
61
|
return event;
|
|
@@ -69,11 +63,13 @@ class IamExpiredInterceptorService {
|
|
|
69
63
|
}
|
|
70
64
|
handleError(err) {
|
|
71
65
|
if (err instanceof HttpErrorResponse) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
// status is 200, but still an error since
|
|
67
|
+
// login page is returned when xml/json is expected
|
|
68
|
+
const isStatusOk = err.status === 200 /* Ok */;
|
|
69
|
+
const isUrlCyberLogin = err.url.includes(CYBER_LOGIN_PATH);
|
|
70
|
+
const isUrlAcvLogin = err.url.includes(ACV_LOGIN_PATH);
|
|
71
|
+
if (isStatusOk && (isUrlCyberLogin || isUrlAcvLogin)) {
|
|
72
|
+
this._isIamSessionExpired.next(true);
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
return throwError(err);
|
|
@@ -9935,19 +9931,19 @@ class TableSort {
|
|
|
9935
9931
|
class RedirectComponent {
|
|
9936
9932
|
constructor(iamInterceptor) {
|
|
9937
9933
|
this.iamInterceptor = iamInterceptor;
|
|
9938
|
-
this.
|
|
9939
|
-
this.modalBodyText = `<p>Votre session a expiré.</p>
|
|
9940
|
-
<p>Vous pouvez vous connecter à nouveau pour continuer à utiliser nos services.</p>`;
|
|
9941
|
-
this.iamInterceptor.iamExpirationHeaderPresence
|
|
9934
|
+
this.iamInterceptor.isIamSessionExpired
|
|
9942
9935
|
.pipe(first())
|
|
9943
9936
|
.subscribe(() => this.showModal());
|
|
9944
9937
|
}
|
|
9938
|
+
reloadPage() {
|
|
9939
|
+
window.location.reload();
|
|
9940
|
+
}
|
|
9945
9941
|
showModal() {
|
|
9946
9942
|
this.counter = 10;
|
|
9947
9943
|
this.isModalVisible = true;
|
|
9948
9944
|
setInterval(() => {
|
|
9949
9945
|
if (0 === this.counter) {
|
|
9950
|
-
|
|
9946
|
+
this.reloadPage();
|
|
9951
9947
|
return;
|
|
9952
9948
|
}
|
|
9953
9949
|
this.counter--;
|
|
@@ -9955,10 +9951,10 @@ class RedirectComponent {
|
|
|
9955
9951
|
}
|
|
9956
9952
|
}
|
|
9957
9953
|
RedirectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.5", ngImport: i0, type: RedirectComponent, deps: [{ token: IamExpiredInterceptorService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9958
|
-
RedirectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.5", type: RedirectComponent, selector: "redirector", ngImport: i0, template: "<foehn-modal\n [
|
|
9954
|
+
RedirectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.5", type: RedirectComponent, selector: "redirector", ngImport: i0, template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>Vous pouvez <a href=\"#\" (click)=\"$event.preventDefault(); reloadPage();\">vous connecter</a> \u00E0 nouveau pour continuer \u00E0 utiliser nos services.</p>\n\n <div modal-footer class=\"w-100 text-right font-weight-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n", components: [{ type: FoehnModalComponent, selector: "foehn-modal", inputs: ["id", "name", "modalSize", "modalBodyText", "modalHeaderText", "closeable", "modalTriggerHtmlElement", "isModalVisible"], outputs: ["isModalVisibleChange"] }] });
|
|
9959
9955
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.5", ngImport: i0, type: RedirectComponent, decorators: [{
|
|
9960
9956
|
type: Component,
|
|
9961
|
-
args: [{ selector: 'redirector', template: "<foehn-modal\n [
|
|
9957
|
+
args: [{ selector: 'redirector', template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>Vous pouvez <a href=\"#\" (click)=\"$event.preventDefault(); reloadPage();\">vous connecter</a> \u00E0 nouveau pour continuer \u00E0 utiliser nos services.</p>\n\n <div modal-footer class=\"w-100 text-right font-weight-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n" }]
|
|
9962
9958
|
}], ctorParameters: function () { return [{ type: IamExpiredInterceptorService }]; } });
|
|
9963
9959
|
|
|
9964
9960
|
class SdkRedirectModule {
|