@valtimo/security 11.1.5 → 11.2.1
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/esm2022/lib/constants/csp.constant.mjs +19 -0
- package/esm2022/lib/constants/index.mjs +17 -0
- package/esm2022/lib/error/error.mjs +2 -2
- package/esm2022/lib/error/http-error.interceptor.mjs +12 -3
- package/esm2022/lib/initializers/index.mjs +17 -0
- package/esm2022/lib/initializers/initialize-csp.mjs +51 -0
- package/esm2022/lib/interceptors/index.mjs +17 -0
- package/esm2022/lib/interceptors/zone-offset.interceptor.mjs +28 -0
- package/esm2022/lib/security.module.mjs +11 -3
- package/esm2022/public_api.mjs +3 -1
- package/fesm2022/valtimo-security.mjs +163 -7
- package/fesm2022/valtimo-security.mjs.map +1 -1
- package/lib/constants/csp.constant.d.ts +4 -0
- package/lib/constants/csp.constant.d.ts.map +1 -0
- package/lib/constants/index.d.ts +2 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/error/error.d.ts.map +1 -1
- package/lib/error/http-error.interceptor.d.ts.map +1 -1
- package/lib/initializers/index.d.ts +2 -0
- package/lib/initializers/index.d.ts.map +1 -0
- package/lib/initializers/initialize-csp.d.ts +5 -0
- package/lib/initializers/initialize-csp.d.ts.map +1 -0
- package/lib/interceptors/index.d.ts +2 -0
- package/lib/interceptors/index.d.ts.map +1 -0
- package/lib/interceptors/zone-offset.interceptor.d.ts +10 -0
- package/lib/interceptors/zone-offset.interceptor.d.ts.map +1 -0
- package/lib/security.module.d.ts.map +1 -1
- package/package.json +3 -2
- package/public_api.d.ts +2 -0
- package/public_api.d.ts.map +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
const CSP_HTTP_EQUIV = 'Content-Security-Policy';
|
|
17
|
+
const CSP_META_ID = 'CSP_META';
|
|
18
|
+
export { CSP_HTTP_EQUIV, CSP_META_ID };
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3NwLmNvbnN0YW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvdmFsdGltby9zZWN1cml0eS9zcmMvbGliL2NvbnN0YW50cy9jc3AuY29uc3RhbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFFSCxNQUFNLGNBQWMsR0FBRyx5QkFBeUIsQ0FBQztBQUVqRCxNQUFNLFdBQVcsR0FBRyxVQUFVLENBQUM7QUFFL0IsT0FBTyxFQUFDLGNBQWMsRUFBRSxXQUFXLEVBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBDb3B5cmlnaHQgMjAxNS0yMDIzIFJpdGVuc2UgQlYsIHRoZSBOZXRoZXJsYW5kcy5cbiAqXG4gKiBMaWNlbnNlZCB1bmRlciBFVVBMLCBWZXJzaW9uIDEuMiAodGhlIFwiTGljZW5zZVwiKTtcbiAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS5cbiAqIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdFxuICpcbiAqIGh0dHBzOi8vam9pbnVwLmVjLmV1cm9wYS5ldS9jb2xsZWN0aW9uL2V1cGwvZXVwbC10ZXh0LWV1cGwtMTJcbiAqXG4gKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlXG4gKiBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiBcIkFTIElTXCIgYmFzaXMsXG4gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC5cbiAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmRcbiAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLlxuICovXG5cbmNvbnN0IENTUF9IVFRQX0VRVUlWID0gJ0NvbnRlbnQtU2VjdXJpdHktUG9saWN5JztcblxuY29uc3QgQ1NQX01FVEFfSUQgPSAnQ1NQX01FVEEnO1xuXG5leHBvcnQge0NTUF9IVFRQX0VRVUlWLCBDU1BfTUVUQV9JRH07XG4iXX0=
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './csp.constant';
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWx0aW1vL3NlY3VyaXR5L3NyYy9saWIvY29uc3RhbnRzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBRUgsY0FBYyxnQkFBZ0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBDb3B5cmlnaHQgMjAxNS0yMDIzIFJpdGVuc2UgQlYsIHRoZSBOZXRoZXJsYW5kcy5cbiAqXG4gKiBMaWNlbnNlZCB1bmRlciBFVVBMLCBWZXJzaW9uIDEuMiAodGhlIFwiTGljZW5zZVwiKTtcbiAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS5cbiAqIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdFxuICpcbiAqIGh0dHBzOi8vam9pbnVwLmVjLmV1cm9wYS5ldS9jb2xsZWN0aW9uL2V1cGwvZXVwbC10ZXh0LWV1cGwtMTJcbiAqXG4gKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlXG4gKiBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiBcIkFTIElTXCIgYmFzaXMsXG4gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC5cbiAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmRcbiAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vY3NwLmNvbnN0YW50JztcbiJdfQ==
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { HttpHeaders } from '@angular/common/http';
|
|
17
17
|
export const InterceptorSkip = 'X-Skip-Interceptor';
|
|
18
|
-
export const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, '');
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
export const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, 'all');
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWx0aW1vL3NlY3VyaXR5L3NyYy9saWIvZXJyb3IvZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFFSCxPQUFPLEVBQUMsV0FBVyxFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFFakQsTUFBTSxDQUFDLE1BQU0sZUFBZSxHQUFHLG9CQUFvQixDQUFDO0FBQ3BELE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFHLElBQUksV0FBVyxFQUFFLENBQUMsR0FBRyxDQUFDLGVBQWUsRUFBRSxLQUFLLENBQUMsQ0FBQyIs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lciA9IG5ldyBIdHRwSGVhZGVycygpLnNldChJbnRlcmNlcHRvclNraXAsICdhbGwnKTtcblxuZXhwb3J0IGludGVyZmFjZSBFcnJvciB7XG4gIHRpdGxlOiBzdHJpbmc7XG4gIGVycm9yOiBudW1iZXI7XG59XG4iXX0=
|
|
@@ -11,11 +11,20 @@ export class HttpErrorInterceptor {
|
|
|
11
11
|
this.logger = logger;
|
|
12
12
|
}
|
|
13
13
|
intercept(request, next) {
|
|
14
|
+
let skipStatusCodes = [];
|
|
15
|
+
let response$;
|
|
14
16
|
if (request.headers && request.headers.has(InterceptorSkip)) {
|
|
17
|
+
skipStatusCodes = request.headers.get(InterceptorSkip).split(',');
|
|
15
18
|
const headers = request.headers.delete(InterceptorSkip);
|
|
16
|
-
|
|
19
|
+
response$ = next.handle(request.clone({ headers }));
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
else {
|
|
22
|
+
response$ = next.handle(request);
|
|
23
|
+
}
|
|
24
|
+
return response$.pipe(catchError((error) => {
|
|
25
|
+
if (skipStatusCodes.find(skipStatusCode => skipStatusCode === 'all' || skipStatusCode === error.status.toString())) {
|
|
26
|
+
return response$;
|
|
27
|
+
}
|
|
19
28
|
let errorMessage = '';
|
|
20
29
|
if (error?.error instanceof ErrorEvent) {
|
|
21
30
|
// client-side error
|
|
@@ -55,4 +64,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
55
64
|
providedIn: 'root',
|
|
56
65
|
}]
|
|
57
66
|
}], ctorParameters: function () { return [{ type: i1.ToastrService }, { type: i2.NGXLogger }]; } });
|
|
58
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC1lcnJvci5pbnRlcmNlcHRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2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R7ZXJyb3I/LmVycm9yPy5kZXRhaWx9YDtcbiAgICAgICAgICB9IGVsc2UgaWYgKGVycm9yPy5lcnJvcj8ubWVzc2FnZSkge1xuICAgICAgICAgICAgZXJyb3JNZXNzYWdlID0gZXJyb3I/LmVycm9yPy5tZXNzYWdlO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBlcnJvck1lc3NhZ2UgPSBgRXJyb3IgQ29kZTogJHtlcnJvcj8uc3RhdHVzfSA8L2JyPk1lc3NhZ2U6ICR7ZXJyb3I/Lm1lc3NhZ2V9YDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy50b2FzdHIud2FybmluZyhgJHtlcnJvck1lc3NhZ2V9YCwgYEFuIHVuZXhwZWN0ZWQgZXJyb3Igb2NjdXJyZWRgLCB7XG4gICAgICAgICAgZW5hYmxlSHRtbDogdHJ1ZSxcbiAgICAgICAgICB0YXBUb0Rpc21pc3M6IGZhbHNlLFxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHRocm93RXJyb3IoZXJyb3JNZXNzYWdlKTtcbiAgICAgIH0pXG4gICAgKTtcbiAgfVxufVxuIl19
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16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B0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmRcbiAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5pdGlhbGl6ZS1jc3AnO1xuIl19
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CSP_HTTP_EQUIV, CSP_META_ID } from '../constants';
|
|
17
|
+
import { getCSP } from 'csp-header';
|
|
18
|
+
import { SecurityContext } from '@angular/core';
|
|
19
|
+
const getSanitizedCspString = (cspHeaderParams, domSanitizer) => {
|
|
20
|
+
const csp = getCSP(cspHeaderParams);
|
|
21
|
+
return domSanitizer.sanitize(SecurityContext.HTML, csp);
|
|
22
|
+
};
|
|
23
|
+
const getCspHeaderElement = (cspHeaderParams, domSanitizer, document) => {
|
|
24
|
+
const csp = getSanitizedCspString(cspHeaderParams, domSanitizer);
|
|
25
|
+
const cspMeta = document.createElement('meta');
|
|
26
|
+
cspMeta.httpEquiv = CSP_HTTP_EQUIV;
|
|
27
|
+
cspMeta.content = csp;
|
|
28
|
+
cspMeta.id = CSP_META_ID;
|
|
29
|
+
return cspMeta;
|
|
30
|
+
};
|
|
31
|
+
const appendElementToHead = (element, document) => {
|
|
32
|
+
document.head.appendChild(element);
|
|
33
|
+
};
|
|
34
|
+
const isElementLoaded = async (elementId, document) => {
|
|
35
|
+
while (document.getElementById(elementId) === null) {
|
|
36
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
37
|
+
}
|
|
38
|
+
return !!document.getElementById(elementId);
|
|
39
|
+
};
|
|
40
|
+
export const initializeCsp = (logger, configService, document, domSanitizer) => async () => {
|
|
41
|
+
const cspHeaderParams = configService?.config?.csp;
|
|
42
|
+
if (cspHeaderParams) {
|
|
43
|
+
logger.log('Create CSP header element from:', cspHeaderParams);
|
|
44
|
+
const cspHeaderElement = getCspHeaderElement(cspHeaderParams, domSanitizer, document);
|
|
45
|
+
appendElementToHead(cspHeaderElement, document);
|
|
46
|
+
return await isElementLoaded(CSP_META_ID, document);
|
|
47
|
+
}
|
|
48
|
+
logger.log('No CSP config present.');
|
|
49
|
+
return true;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5pdGlhbGl6ZS1jc3AuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWx0aW1vL3NlY3VyaXR5L3NyYy9saWIvaW5pdGlhbGl6ZXJzL2luaXRpYWxpemUtY3NwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBSUgsT0FBTyxFQUFDLGNBQWMsRUFBRSxXQUFXLEVBQUMsTUFBTSxjQUFjLENBQUM7QUFFekQsT0FBTyxFQUFrQixNQUFNLEVBQUMsTUFBTSxZQUFZLENBQUM7QUFDbkQsT0FBTyxFQUFDLGVBQWUsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUU5QyxNQUFNLHFCQUFxQixHQUFHLENBQzVCL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1xuXG4gICAgcmV0dXJuIHRydWU7XG4gIH07XG4iXX0=
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './zone-offset.interceptor';
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWx0aW1vL3NlY3VyaXR5L3NyYy9saWIvaW50ZXJjZXB0b3JzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBRUgsY0FBYywyQkFBMkIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBDb3B5cmlnaHQgMjAxNS0yMDIzIFJpdGVuc2UgQlYsIHRoZSBOZXRoZXJsYW5kcy5cbiAqXG4gKiBMaWNlbnNlZCB1bmRlciBFVVBMLCBWZXJzaW9uIDEuMiAodGhlIFwiTGljZW5zZVwiKTtcbiAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS5cbiAqIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdFxuICpcbiAqIGh0dHBzOi8vam9pbnVwLmVjLmV1cm9wYS5ldS9jb2xsZWN0aW9uL2V1cGwvZXVwbC10ZXh0LWV1cGwtMTJcbiAqXG4gKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlXG4gKiBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiBcIkFTIElTXCIgYmFzaXMsXG4gKiBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC5cbiAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmRcbiAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vem9uZS1vZmZzZXQuaW50ZXJjZXB0b3InO1xuIl19
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class ZoneOffsetInterceptor {
|
|
5
|
+
intercept(req, next) {
|
|
6
|
+
const modifiedReq = req.clone({
|
|
7
|
+
headers: req.headers.set('X-Timezone-Offset', this.getFormattedZoneOffset()),
|
|
8
|
+
});
|
|
9
|
+
return next.handle(modifiedReq);
|
|
10
|
+
}
|
|
11
|
+
getFormattedZoneOffset() {
|
|
12
|
+
let offset = new Date().getTimezoneOffset();
|
|
13
|
+
let isNegative = false;
|
|
14
|
+
if (offset < 0) {
|
|
15
|
+
isNegative = true;
|
|
16
|
+
offset = offset * -1;
|
|
17
|
+
}
|
|
18
|
+
const duration = moment.duration(offset, 'minutes');
|
|
19
|
+
const momentOffset = moment.utc(duration.asMilliseconds()).format('HH:mm');
|
|
20
|
+
return `${isNegative ? '+' : '-'}${momentOffset}`;
|
|
21
|
+
}
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
23
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor }); }
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor, decorators: [{
|
|
26
|
+
type: Injectable
|
|
27
|
+
}] });
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiem9uZS1vZmZzZXQuaW50ZXJjZXB0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWx0aW1vL3NlY3VyaXR5L3NyYy9saWIvaW50ZXJjZXB0b3JzL3pvbmUtb2Zmc2V0LmludGVyY2VwdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlCQSxPQUFPLEVBQUMsVUFBVSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBRXpDLE9BQU8sTUFBTSxNQUFNLFFBQVEsQ0FBQzs7QUFHNUIsTUFBTSxPQUFPLHFCQUFxQjtJQUN6QixTQUFTLENBQUMsR0FBcUIsRUFBRSxJQUFpQjtRQUN2RCxNQUFNLFdBQVcsR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDO1lBQzVCLE9BQU8sRUFBRSxHQUFHLENBQUMsT0FBTyx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ocmVxOiBIdHRwUmVxdWVzdDxhbnk+LCBuZXh0OiBIdHRwSGFuZGxlcik6IE9ic2VydmFibGU8SHR0cEV2ZW50PGFueT4+IHtcbiAgICBjb25zdCBtb2RpZmllZFJlcSA9IHJlcS5jbG9uZSh7XG4gICAgICBoZWFkZXJzOiByZXEuaGVhZGVycy5zZXQoJ1gtVGltZXpvbmUtT2Zmc2V0JywgdGhpcy5nZXRGb3JtYXR0ZWRab25lT2Zmc2V0KCkpLFxuICAgIH0pO1xuICAgIHJldHVybiBuZXh0LmhhbmRsZShtb2RpZmllZFJlcSk7XG4gIH1cblxuICBwcml2YXRlIGdldEZvcm1hdHRlZFpvbmVPZmZzZXQoKTogc3RyaW5nIHtcbiAgICBsZXQgb2Zmc2V0ID0gbmV3IERhdGUoKS5nZXRUaW1lem9uZU9mZnNldCgpO1xuICAgIGxldCBpc05lZ2F0aXZlID0gZmFsc2U7XG5cbiAgICBpZiAob2Zmc2V0IDwgMCkge1xuICAgICAgaXNOZWdhdGl2ZSA9IHRydWU7XG4gICAgICBvZmZzZXQgPSBvZmZzZXQgKiAtMTtcbiAgICB9XG5cbiAgICBjb25zdCBkdXJhdGlvbiA9IG1vbWVudC5kdXJhdGlvbihvZmZzZXQsICdtaW51dGVzJyk7XG4gICAgY29uc3QgbW9tZW50T2Zmc2V0ID0gbW9tZW50LnV0YyhkdXJhdGlvbi5hc01pbGxpc2Vjb25kcygpKS5mb3JtYXQoJ0hIOm1tJyk7XG5cbiAgICByZXR1cm4gYCR7aXNOZWdhdGl2ZSA/ICcrJyA6ICctJ30ke21vbWVudE9mZnNldH1gO1xuICB9XG59XG4iXX0=
|
|
@@ -17,11 +17,16 @@ import { NgModule } from '@angular/core';
|
|
|
17
17
|
import { ErrorComponent } from './error/error.component';
|
|
18
18
|
import { ErrorRoutingModule } from './error/error-routing.module';
|
|
19
19
|
import { AuthGuardService } from './guard/auth-guard.service';
|
|
20
|
+
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
21
|
+
import { ZoneOffsetInterceptor } from './interceptors';
|
|
20
22
|
import * as i0 from "@angular/core";
|
|
21
23
|
export class SecurityModule {
|
|
22
24
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
23
25
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, declarations: [ErrorComponent], imports: [ErrorRoutingModule], exports: [ErrorComponent] }); }
|
|
24
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, providers: [
|
|
26
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, providers: [
|
|
27
|
+
AuthGuardService,
|
|
28
|
+
{ provide: HTTP_INTERCEPTORS, useClass: ZoneOffsetInterceptor, multi: true },
|
|
29
|
+
], imports: [ErrorRoutingModule] }); }
|
|
25
30
|
}
|
|
26
31
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, decorators: [{
|
|
27
32
|
type: NgModule,
|
|
@@ -29,7 +34,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
29
34
|
declarations: [ErrorComponent],
|
|
30
35
|
imports: [ErrorRoutingModule],
|
|
31
36
|
exports: [ErrorComponent],
|
|
32
|
-
providers: [
|
|
37
|
+
providers: [
|
|
38
|
+
AuthGuardService,
|
|
39
|
+
{ provide: HTTP_INTERCEPTORS, useClass: ZoneOffsetInterceptor, multi: true },
|
|
40
|
+
],
|
|
33
41
|
}]
|
|
34
42
|
}] });
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2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yZSc7XG5pbXBvcnQge0Vycm9yQ29tcG9uZW50fSBmcm9tICcuL2Vycm9yL2Vycm9yLmNvbXBvbmVudCc7XG5pbXBvcnQge0Vycm9yUm91dGluZ01vZHVsZX0gZnJvbSAnLi9lcnJvci9lcnJvci1yb3V0aW5nLm1vZHVsZSc7XG5pbXBvcnQge0F1dGhHdWFyZFNlcnZpY2V9IGZyb20gJy4vZ3VhcmQvYXV0aC1ndWFyZC5zZXJ2aWNlJztcbmltcG9ydCB7SFRUUF9JTlRFUkNFUFRPUlN9IGZyb20gJ0Bhbmd1bGFyL2NvbW1vbi9odHRwJztcbmltcG9ydCB7Wm9uZU9mZnNldEludGVyY2VwdG9yfSBmcm9tICcuL2ludGVyY2VwdG9ycyc7XG5cbkBOZ01vZHVsZSh7XG4gIGRlY2xhcmF0aW9uczogW0Vycm9yQ29tcG9uZW50XSxcbiAgaW1wb3J0czogW0Vycm9yUm91dGluZ01vZHVsZV0sXG4gIGV4cG9ydHM6IFtFcnJvckNvbXBvbmVudF0sXG4gIHByb3ZpZGVyczogW1xuICAgIEF1dGhHdWFyZFNlcnZpY2UsXG4gICAge3Byb3ZpZGU6IEhUVFBfSU5URVJDRVBUT1JTLCB1c2VDbGFzczogWm9uZU9mZnNldEludGVyY2VwdG9yLCBtdWx0aTogdHJ1ZX0sXG4gIF0sXG59KVxuZXhwb3J0IGNsYXNzIFNlY3VyaXR5TW9kdWxlIHt9XG4iXX0=
|
package/esm2022/public_api.mjs
CHANGED
|
@@ -21,4 +21,6 @@ export * from './lib/security.module';
|
|
|
21
21
|
export * from './lib/error/error';
|
|
22
22
|
export * from './lib/error/error.component';
|
|
23
23
|
export * from './lib/user-provider.service';
|
|
24
|
-
|
|
24
|
+
export * from './lib/constants';
|
|
25
|
+
export * from './lib/initializers';
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3Vy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U5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuXG4gKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kXG4gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS5cbiAqL1xuXG4vKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIHNlY3VyaXR5XG4gKi9cbmV4cG9ydCAqIGZyb20gJy4vbGliL2d1YXJkL2F1dGgtZ3VhcmQuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9zZWN1cml0eS5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvZXJyb3IvZXJyb3InO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvZXJyb3IvZXJyb3IuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3VzZXItcHJvdmlkZXIuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb25zdGFudHMnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvaW5pdGlhbGl6ZXJzJztcbiJdfQ==
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, NgModule } from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule, SecurityContext } from '@angular/core';
|
|
3
3
|
import * as i1 from '@valtimo/config';
|
|
4
4
|
import * as i2 from 'ngx-logger';
|
|
5
5
|
import * as i1$1 from '@angular/router';
|
|
@@ -10,6 +10,8 @@ import { catchError } from 'rxjs/operators';
|
|
|
10
10
|
import * as i2$1 from '@angular/common/http';
|
|
11
11
|
import { HttpHeaders, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
12
12
|
import * as i1$2 from 'ngx-toastr';
|
|
13
|
+
import moment from 'moment';
|
|
14
|
+
import { getCSP } from 'csp-header';
|
|
13
15
|
|
|
14
16
|
/*
|
|
15
17
|
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
@@ -98,7 +100,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
98
100
|
* limitations under the License.
|
|
99
101
|
*/
|
|
100
102
|
const InterceptorSkip = 'X-Skip-Interceptor';
|
|
101
|
-
const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, '');
|
|
103
|
+
const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, 'all');
|
|
102
104
|
|
|
103
105
|
class HttpErrorInterceptor {
|
|
104
106
|
constructor(toastr, logger) {
|
|
@@ -106,11 +108,20 @@ class HttpErrorInterceptor {
|
|
|
106
108
|
this.logger = logger;
|
|
107
109
|
}
|
|
108
110
|
intercept(request, next) {
|
|
111
|
+
let skipStatusCodes = [];
|
|
112
|
+
let response$;
|
|
109
113
|
if (request.headers && request.headers.has(InterceptorSkip)) {
|
|
114
|
+
skipStatusCodes = request.headers.get(InterceptorSkip).split(',');
|
|
110
115
|
const headers = request.headers.delete(InterceptorSkip);
|
|
111
|
-
|
|
116
|
+
response$ = next.handle(request.clone({ headers }));
|
|
112
117
|
}
|
|
113
|
-
|
|
118
|
+
else {
|
|
119
|
+
response$ = next.handle(request);
|
|
120
|
+
}
|
|
121
|
+
return response$.pipe(catchError((error) => {
|
|
122
|
+
if (skipStatusCodes.find(skipStatusCode => skipStatusCode === 'all' || skipStatusCode === error.status.toString())) {
|
|
123
|
+
return response$;
|
|
124
|
+
}
|
|
114
125
|
let errorMessage = '';
|
|
115
126
|
if (error?.error instanceof ErrorEvent) {
|
|
116
127
|
// client-side error
|
|
@@ -187,6 +198,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
187
198
|
}]
|
|
188
199
|
}] });
|
|
189
200
|
|
|
201
|
+
class ZoneOffsetInterceptor {
|
|
202
|
+
intercept(req, next) {
|
|
203
|
+
const modifiedReq = req.clone({
|
|
204
|
+
headers: req.headers.set('X-Timezone-Offset', this.getFormattedZoneOffset()),
|
|
205
|
+
});
|
|
206
|
+
return next.handle(modifiedReq);
|
|
207
|
+
}
|
|
208
|
+
getFormattedZoneOffset() {
|
|
209
|
+
let offset = new Date().getTimezoneOffset();
|
|
210
|
+
let isNegative = false;
|
|
211
|
+
if (offset < 0) {
|
|
212
|
+
isNegative = true;
|
|
213
|
+
offset = offset * -1;
|
|
214
|
+
}
|
|
215
|
+
const duration = moment.duration(offset, 'minutes');
|
|
216
|
+
const momentOffset = moment.utc(duration.asMilliseconds()).format('HH:mm');
|
|
217
|
+
return `${isNegative ? '+' : '-'}${momentOffset}`;
|
|
218
|
+
}
|
|
219
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
220
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor }); }
|
|
221
|
+
}
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ZoneOffsetInterceptor, decorators: [{
|
|
223
|
+
type: Injectable
|
|
224
|
+
}] });
|
|
225
|
+
|
|
226
|
+
/*
|
|
227
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
228
|
+
*
|
|
229
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
230
|
+
* you may not use this file except in compliance with the License.
|
|
231
|
+
* You may obtain a copy of the License at
|
|
232
|
+
*
|
|
233
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
234
|
+
*
|
|
235
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
236
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
237
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
238
|
+
* See the License for the specific language governing permissions and
|
|
239
|
+
* limitations under the License.
|
|
240
|
+
*/
|
|
241
|
+
|
|
190
242
|
/*
|
|
191
243
|
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
192
244
|
*
|
|
@@ -205,7 +257,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
205
257
|
class SecurityModule {
|
|
206
258
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
207
259
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, declarations: [ErrorComponent], imports: [ErrorRoutingModule], exports: [ErrorComponent] }); }
|
|
208
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, providers: [
|
|
260
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, providers: [
|
|
261
|
+
AuthGuardService,
|
|
262
|
+
{ provide: HTTP_INTERCEPTORS, useClass: ZoneOffsetInterceptor, multi: true },
|
|
263
|
+
], imports: [ErrorRoutingModule] }); }
|
|
209
264
|
}
|
|
210
265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SecurityModule, decorators: [{
|
|
211
266
|
type: NgModule,
|
|
@@ -213,7 +268,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
213
268
|
declarations: [ErrorComponent],
|
|
214
269
|
imports: [ErrorRoutingModule],
|
|
215
270
|
exports: [ErrorComponent],
|
|
216
|
-
providers: [
|
|
271
|
+
providers: [
|
|
272
|
+
AuthGuardService,
|
|
273
|
+
{ provide: HTTP_INTERCEPTORS, useClass: ZoneOffsetInterceptor, multi: true },
|
|
274
|
+
],
|
|
217
275
|
}]
|
|
218
276
|
}] });
|
|
219
277
|
|
|
@@ -279,6 +337,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
279
337
|
}]
|
|
280
338
|
}], ctorParameters: function () { return [{ type: i1.ConfigService }, { type: i0.Injector }, { type: i2$1.HttpClient }, { type: i2.NGXLogger }]; } });
|
|
281
339
|
|
|
340
|
+
/*
|
|
341
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
342
|
+
*
|
|
343
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
344
|
+
* you may not use this file except in compliance with the License.
|
|
345
|
+
* You may obtain a copy of the License at
|
|
346
|
+
*
|
|
347
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
348
|
+
*
|
|
349
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
350
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
351
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
352
|
+
* See the License for the specific language governing permissions and
|
|
353
|
+
* limitations under the License.
|
|
354
|
+
*/
|
|
355
|
+
const CSP_HTTP_EQUIV = 'Content-Security-Policy';
|
|
356
|
+
const CSP_META_ID = 'CSP_META';
|
|
357
|
+
|
|
358
|
+
/*
|
|
359
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
360
|
+
*
|
|
361
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
362
|
+
* you may not use this file except in compliance with the License.
|
|
363
|
+
* You may obtain a copy of the License at
|
|
364
|
+
*
|
|
365
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
366
|
+
*
|
|
367
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
368
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
369
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
370
|
+
* See the License for the specific language governing permissions and
|
|
371
|
+
* limitations under the License.
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
/*
|
|
375
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
376
|
+
*
|
|
377
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
378
|
+
* you may not use this file except in compliance with the License.
|
|
379
|
+
* You may obtain a copy of the License at
|
|
380
|
+
*
|
|
381
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
382
|
+
*
|
|
383
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
384
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
385
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
386
|
+
* See the License for the specific language governing permissions and
|
|
387
|
+
* limitations under the License.
|
|
388
|
+
*/
|
|
389
|
+
const getSanitizedCspString = (cspHeaderParams, domSanitizer) => {
|
|
390
|
+
const csp = getCSP(cspHeaderParams);
|
|
391
|
+
return domSanitizer.sanitize(SecurityContext.HTML, csp);
|
|
392
|
+
};
|
|
393
|
+
const getCspHeaderElement = (cspHeaderParams, domSanitizer, document) => {
|
|
394
|
+
const csp = getSanitizedCspString(cspHeaderParams, domSanitizer);
|
|
395
|
+
const cspMeta = document.createElement('meta');
|
|
396
|
+
cspMeta.httpEquiv = CSP_HTTP_EQUIV;
|
|
397
|
+
cspMeta.content = csp;
|
|
398
|
+
cspMeta.id = CSP_META_ID;
|
|
399
|
+
return cspMeta;
|
|
400
|
+
};
|
|
401
|
+
const appendElementToHead = (element, document) => {
|
|
402
|
+
document.head.appendChild(element);
|
|
403
|
+
};
|
|
404
|
+
const isElementLoaded = async (elementId, document) => {
|
|
405
|
+
while (document.getElementById(elementId) === null) {
|
|
406
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
407
|
+
}
|
|
408
|
+
return !!document.getElementById(elementId);
|
|
409
|
+
};
|
|
410
|
+
const initializeCsp = (logger, configService, document, domSanitizer) => async () => {
|
|
411
|
+
const cspHeaderParams = configService?.config?.csp;
|
|
412
|
+
if (cspHeaderParams) {
|
|
413
|
+
logger.log('Create CSP header element from:', cspHeaderParams);
|
|
414
|
+
const cspHeaderElement = getCspHeaderElement(cspHeaderParams, domSanitizer, document);
|
|
415
|
+
appendElementToHead(cspHeaderElement, document);
|
|
416
|
+
return await isElementLoaded(CSP_META_ID, document);
|
|
417
|
+
}
|
|
418
|
+
logger.log('No CSP config present.');
|
|
419
|
+
return true;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/*
|
|
423
|
+
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
424
|
+
*
|
|
425
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
426
|
+
* you may not use this file except in compliance with the License.
|
|
427
|
+
* You may obtain a copy of the License at
|
|
428
|
+
*
|
|
429
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
430
|
+
*
|
|
431
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
432
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
433
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
434
|
+
* See the License for the specific language governing permissions and
|
|
435
|
+
* limitations under the License.
|
|
436
|
+
*/
|
|
437
|
+
|
|
282
438
|
/*
|
|
283
439
|
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
284
440
|
*
|
|
@@ -302,5 +458,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
302
458
|
* Generated bundle index. Do not edit.
|
|
303
459
|
*/
|
|
304
460
|
|
|
305
|
-
export { AuthGuardService, ErrorComponent, InterceptorSkip, InterceptorSkipHeader, SecurityModule, UserProviderService };
|
|
461
|
+
export { AuthGuardService, CSP_HTTP_EQUIV, CSP_META_ID, ErrorComponent, InterceptorSkip, InterceptorSkipHeader, SecurityModule, UserProviderService, initializeCsp };
|
|
306
462
|
//# sourceMappingURL=valtimo-security.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valtimo-security.mjs","sources":["../../../../projects/valtimo/security/src/lib/guard/auth-guard.service.ts","../../../../projects/valtimo/security/src/lib/error/error.component.ts","../../../../projects/valtimo/security/src/lib/error/error.component.html","../../../../projects/valtimo/security/src/lib/error/error.ts","../../../../projects/valtimo/security/src/lib/error/http-error.interceptor.ts","../../../../projects/valtimo/security/src/lib/error/error-routing.module.ts","../../../../projects/valtimo/security/src/lib/security.module.ts","../../../../projects/valtimo/security/src/lib/user-provider.service.ts","../../../../projects/valtimo/security/src/public_api.ts","../../../../projects/valtimo/security/src/valtimo-security.ts"],"sourcesContent":["/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable, Injector} from '@angular/core';\nimport {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree} from '@angular/router';\nimport {NGXLogger} from 'ngx-logger';\nimport {Observable} from 'rxjs';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuardService implements CanActivate {\n private readonly authGuardServiceProvider: CanActivate;\n\n constructor(\n configService: ConfigService,\n private injector: Injector,\n protected logger: NGXLogger\n ) {\n this.authGuardServiceProvider = injector.get<any>(\n configService.config.authentication.authProviders.guardServiceProvider\n );\n this.logger.debug('Loading AuthGuardServiceProvider service', this.authGuardServiceProvider);\n }\n\n canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n this.logger.debug('Delegating AuthGuard canActivate');\n return this.authGuardServiceProvider.canActivate(route, state);\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Component, OnInit} from '@angular/core';\nimport {ActivatedRoute} from '@angular/router';\nimport {Error} from './error';\n\n@Component({\n selector: 'valtimo-error',\n templateUrl: './error.component.html',\n styleUrls: ['./error.component.css'],\n})\nexport class ErrorComponent implements OnInit {\n public err: Error;\n\n constructor(private activatedRoute: ActivatedRoute) {}\n\n ngOnInit() {\n if (this.activatedRoute.snapshot.data) {\n this.err = {\n title: this.activatedRoute.snapshot.data.title,\n error: this.activatedRoute.snapshot.data.error,\n };\n }\n }\n}\n","<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-12\">\n <h1>{{ err.error }}</h1>\n <p>{{ err.title }}</p>\n </div>\n </div>\n </div>\n</div>\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {HttpHeaders} from '@angular/common/http';\n\nexport const InterceptorSkip = 'X-Skip-Interceptor';\nexport const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, '');\n\nexport interface Error {\n title: string;\n error: number;\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\nimport {Observable, throwError} from 'rxjs';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {ToastrService} from 'ngx-toastr';\nimport {InterceptorSkip} from './error';\nimport {NGXLogger} from 'ngx-logger';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HttpErrorInterceptor implements HttpInterceptor {\n constructor(\n private toastr: ToastrService,\n private logger: NGXLogger\n ) {}\n\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n if (request.headers && request.headers.has(InterceptorSkip)) {\n const headers = request.headers.delete(InterceptorSkip);\n return next.handle(request.clone({headers}));\n }\n\n return next.handle(request).pipe(\n catchError((error: HttpErrorResponse) => {\n let errorMessage = '';\n if (error?.error instanceof ErrorEvent) {\n // client-side error\n errorMessage = `Error: ${error.error.message}`;\n } else {\n // server-side error\n if (error?.error?.errors) {\n errorMessage = error?.error?.errors;\n } else if (error?.error?.title && error?.error?.referenceId) {\n errorMessage = `${error?.error?.title}. Reference ID: ${error?.error?.referenceId}`;\n } else if (error?.error?.title && error?.error?.detail) {\n errorMessage = `${error?.error?.title}. Details: </br>${error?.error?.detail}`;\n } else if (error?.error?.message) {\n errorMessage = error?.error?.message;\n } else {\n errorMessage = `Error Code: ${error?.status} </br>Message: ${error?.message}`;\n }\n }\n this.toastr.warning(`${errorMessage}`, `An unexpected error occurred`, {\n enableHtml: true,\n tapToDismiss: false,\n });\n return throwError(errorMessage);\n })\n );\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {CommonModule} from '@angular/common';\nimport {ErrorComponent} from './error.component';\nimport {HttpErrorInterceptor} from './http-error.interceptor';\nimport {HTTP_INTERCEPTORS} from '@angular/common/http';\n\nconst routes: Routes = [\n {path: '403', component: ErrorComponent, data: {title: 'Access Forbidden', error: 403}},\n {path: '404', component: ErrorComponent, data: {title: 'Not Found', error: 404}},\n {path: '500', component: ErrorComponent, data: {title: 'Internal Server Error', error: 500}},\n {path: '503', component: ErrorComponent, data: {title: 'Service Unavailable', error: 503}},\n];\n\n@NgModule({\n declarations: [],\n imports: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n providers: [{provide: HTTP_INTERCEPTORS, useClass: HttpErrorInterceptor, multi: true}],\n})\nexport class ErrorRoutingModule {}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {ErrorComponent} from './error/error.component';\nimport {ErrorRoutingModule} from './error/error-routing.module';\nimport {AuthGuardService} from './guard/auth-guard.service';\n\n@NgModule({\n declarations: [ErrorComponent],\n imports: [ErrorRoutingModule],\n exports: [ErrorComponent],\n providers: [AuthGuardService],\n})\nexport class SecurityModule {}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable, Injector} from '@angular/core';\nimport {Observable, ReplaySubject} from 'rxjs';\nimport {NGXLogger} from 'ngx-logger';\nimport {\n ConfigService,\n EmailNotificationService,\n EmailNotificationSettings,\n UserIdentity,\n UserService,\n} from '@valtimo/config';\nimport {HttpClient} from '@angular/common/http';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserProviderService implements UserService, EmailNotificationService {\n private readonly userService: UserService;\n private valtimoApiConfig: {\n endpointUri: string;\n };\n\n constructor(\n private configService: ConfigService,\n private injector: Injector,\n private http: HttpClient,\n private logger: NGXLogger\n ) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n this.userService = injector.get<any>(\n configService.config.authentication.authProviders.userServiceProvider\n );\n this.logger.debug('Loading UserProviderService service', this.userService);\n }\n\n getUserSubject(): ReplaySubject<UserIdentity> {\n this.logger.debug('Delegating UserProviderService::getUserIdentity');\n return this.userService.getUserSubject();\n }\n\n logout(): void {\n this.logger.debug('Delegating UserProviderService::logout');\n return this.userService.logout();\n }\n\n async getToken(): Promise<string> {\n this.logger.debug('Delegating UserProviderService::getToken');\n return this.userService.getToken();\n }\n\n async updateToken(minValidity: number): Promise<boolean> {\n this.logger.debug('Delegating UserProviderService::updateToken');\n if (this.userService.updateToken) {\n return this.userService.updateToken(minValidity);\n }\n\n return new Promise(resolve => resolve(true));\n }\n\n public getEmailNotificationSettings(): Observable<EmailNotificationSettings> {\n this.logger.debug('getEmailNotificationSettings');\n return this.http.get<EmailNotificationSettings>(\n `${this.valtimoApiConfig.endpointUri}v1/email-notification-settings`\n );\n }\n\n public updateEmailNotificationSettings(\n settings: EmailNotificationSettings\n ): Observable<EmailNotificationSettings> {\n this.logger.debug('updateEmailNotificationSettings', settings);\n return this.http.put<EmailNotificationSettings>(\n `${this.valtimoApiConfig.endpointUri}v1/email-notification-settings`,\n settings\n );\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Public API Surface of security\n */\nexport * from './lib/guard/auth-guard.service';\nexport * from './lib/security.module';\nexport * from './lib/error/error';\nexport * from './lib/error/error.component';\nexport * from './lib/user-provider.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3"],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;MAWU,gBAAgB,CAAA;AAG3B,IAAA,WAAA,CACE,aAA4B,EACpB,QAAkB,EAChB,MAAiB,EAAA;QADnB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAChB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAW;AAE3B,QAAA,IAAI,CAAC,wBAAwB,GAAG,QAAQ,CAAC,GAAG,CAC1C,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,oBAAoB,CACvE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;KAC9F;IAED,WAAW,CACT,KAA6B,EAC7B,KAA0B,EAAA;AAE1B,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAChE;+GApBU,gBAAgB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,SAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAA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,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AC9BD;;;;;;;;;;;;;;AAcG;AAEH;;AAEG;;AClBH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"valtimo-security.mjs","sources":["../../../../projects/valtimo/security/src/lib/guard/auth-guard.service.ts","../../../../projects/valtimo/security/src/lib/error/error.component.ts","../../../../projects/valtimo/security/src/lib/error/error.component.html","../../../../projects/valtimo/security/src/lib/error/error.ts","../../../../projects/valtimo/security/src/lib/error/http-error.interceptor.ts","../../../../projects/valtimo/security/src/lib/error/error-routing.module.ts","../../../../projects/valtimo/security/src/lib/interceptors/zone-offset.interceptor.ts","../../../../projects/valtimo/security/src/lib/interceptors/index.ts","../../../../projects/valtimo/security/src/lib/security.module.ts","../../../../projects/valtimo/security/src/lib/user-provider.service.ts","../../../../projects/valtimo/security/src/lib/constants/csp.constant.ts","../../../../projects/valtimo/security/src/lib/constants/index.ts","../../../../projects/valtimo/security/src/lib/initializers/initialize-csp.ts","../../../../projects/valtimo/security/src/lib/initializers/index.ts","../../../../projects/valtimo/security/src/public_api.ts","../../../../projects/valtimo/security/src/valtimo-security.ts"],"sourcesContent":["/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable, Injector} from '@angular/core';\nimport {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree} from '@angular/router';\nimport {NGXLogger} from 'ngx-logger';\nimport {Observable} from 'rxjs';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuardService implements CanActivate {\n private readonly authGuardServiceProvider: CanActivate;\n\n constructor(\n configService: ConfigService,\n private injector: Injector,\n protected logger: NGXLogger\n ) {\n this.authGuardServiceProvider = injector.get<any>(\n configService.config.authentication.authProviders.guardServiceProvider\n );\n this.logger.debug('Loading AuthGuardServiceProvider service', this.authGuardServiceProvider);\n }\n\n canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n this.logger.debug('Delegating AuthGuard canActivate');\n return this.authGuardServiceProvider.canActivate(route, state);\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Component, OnInit} from '@angular/core';\nimport {ActivatedRoute} from '@angular/router';\nimport {Error} from './error';\n\n@Component({\n selector: 'valtimo-error',\n templateUrl: './error.component.html',\n styleUrls: ['./error.component.css'],\n})\nexport class ErrorComponent implements OnInit {\n public err: Error;\n\n constructor(private activatedRoute: ActivatedRoute) {}\n\n ngOnInit() {\n if (this.activatedRoute.snapshot.data) {\n this.err = {\n title: this.activatedRoute.snapshot.data.title,\n error: this.activatedRoute.snapshot.data.error,\n };\n }\n }\n}\n","<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-12\">\n <h1>{{ err.error }}</h1>\n <p>{{ err.title }}</p>\n </div>\n </div>\n </div>\n</div>\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {HttpHeaders} from '@angular/common/http';\n\nexport const InterceptorSkip = 'X-Skip-Interceptor';\nexport const InterceptorSkipHeader = new HttpHeaders().set(InterceptorSkip, 'all');\n\nexport interface Error {\n title: string;\n error: number;\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\nimport {Observable, throwError} from 'rxjs';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {ToastrService} from 'ngx-toastr';\nimport {InterceptorSkip} from './error';\nimport {NGXLogger} from 'ngx-logger';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HttpErrorInterceptor implements HttpInterceptor {\n constructor(\n private toastr: ToastrService,\n private logger: NGXLogger\n ) {}\n\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n let skipStatusCodes: string[] = [];\n let response$: Observable<HttpEvent<any>>;\n if (request.headers && request.headers.has(InterceptorSkip)) {\n skipStatusCodes = request.headers.get(InterceptorSkip).split(',');\n const headers = request.headers.delete(InterceptorSkip);\n response$ = next.handle(request.clone({headers}));\n } else {\n response$ = next.handle(request);\n }\n\n return response$.pipe(\n catchError((error: HttpErrorResponse) => {\n if (\n skipStatusCodes.find(\n skipStatusCode => skipStatusCode === 'all' || skipStatusCode === error.status.toString()\n )\n ) {\n return response$;\n }\n let errorMessage = '';\n if (error?.error instanceof ErrorEvent) {\n // client-side error\n errorMessage = `Error: ${error.error.message}`;\n } else {\n // server-side error\n if (error?.error?.errors) {\n errorMessage = error?.error?.errors;\n } else if (error?.error?.title && error?.error?.referenceId) {\n errorMessage = `${error?.error?.title}. Reference ID: ${error?.error?.referenceId}`;\n } else if (error?.error?.title && error?.error?.detail) {\n errorMessage = `${error?.error?.title}. Details: </br>${error?.error?.detail}`;\n } else if (error?.error?.message) {\n errorMessage = error?.error?.message;\n } else {\n errorMessage = `Error Code: ${error?.status} </br>Message: ${error?.message}`;\n }\n }\n this.toastr.warning(`${errorMessage}`, `An unexpected error occurred`, {\n enableHtml: true,\n tapToDismiss: false,\n });\n return throwError(errorMessage);\n })\n );\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {CommonModule} from '@angular/common';\nimport {ErrorComponent} from './error.component';\nimport {HttpErrorInterceptor} from './http-error.interceptor';\nimport {HTTP_INTERCEPTORS} from '@angular/common/http';\n\nconst routes: Routes = [\n {path: '403', component: ErrorComponent, data: {title: 'Access Forbidden', error: 403}},\n {path: '404', component: ErrorComponent, data: {title: 'Not Found', error: 404}},\n {path: '500', component: ErrorComponent, data: {title: 'Internal Server Error', error: 500}},\n {path: '503', component: ErrorComponent, data: {title: 'Service Unavailable', error: 503}},\n];\n\n@NgModule({\n declarations: [],\n imports: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n providers: [{provide: HTTP_INTERCEPTORS, useClass: HttpErrorInterceptor, multi: true}],\n})\nexport class ErrorRoutingModule {}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {Injectable} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport moment from 'moment';\n\n@Injectable()\nexport class ZoneOffsetInterceptor implements HttpInterceptor {\n public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n const modifiedReq = req.clone({\n headers: req.headers.set('X-Timezone-Offset', this.getFormattedZoneOffset()),\n });\n return next.handle(modifiedReq);\n }\n\n private getFormattedZoneOffset(): string {\n let offset = new Date().getTimezoneOffset();\n let isNegative = false;\n\n if (offset < 0) {\n isNegative = true;\n offset = offset * -1;\n }\n\n const duration = moment.duration(offset, 'minutes');\n const momentOffset = moment.utc(duration.asMilliseconds()).format('HH:mm');\n\n return `${isNegative ? '+' : '-'}${momentOffset}`;\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './zone-offset.interceptor';\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {ErrorComponent} from './error/error.component';\nimport {ErrorRoutingModule} from './error/error-routing.module';\nimport {AuthGuardService} from './guard/auth-guard.service';\nimport {HTTP_INTERCEPTORS} from '@angular/common/http';\nimport {ZoneOffsetInterceptor} from './interceptors';\n\n@NgModule({\n declarations: [ErrorComponent],\n imports: [ErrorRoutingModule],\n exports: [ErrorComponent],\n providers: [\n AuthGuardService,\n {provide: HTTP_INTERCEPTORS, useClass: ZoneOffsetInterceptor, multi: true},\n ],\n})\nexport class SecurityModule {}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable, Injector} from '@angular/core';\nimport {Observable, ReplaySubject} from 'rxjs';\nimport {NGXLogger} from 'ngx-logger';\nimport {\n ConfigService,\n EmailNotificationService,\n EmailNotificationSettings,\n UserIdentity,\n UserService,\n} from '@valtimo/config';\nimport {HttpClient} from '@angular/common/http';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserProviderService implements UserService, EmailNotificationService {\n private readonly userService: UserService;\n private valtimoApiConfig: {\n endpointUri: string;\n };\n\n constructor(\n private configService: ConfigService,\n private injector: Injector,\n private http: HttpClient,\n private logger: NGXLogger\n ) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n this.userService = injector.get<any>(\n configService.config.authentication.authProviders.userServiceProvider\n );\n this.logger.debug('Loading UserProviderService service', this.userService);\n }\n\n getUserSubject(): ReplaySubject<UserIdentity> {\n this.logger.debug('Delegating UserProviderService::getUserIdentity');\n return this.userService.getUserSubject();\n }\n\n logout(): void {\n this.logger.debug('Delegating UserProviderService::logout');\n return this.userService.logout();\n }\n\n async getToken(): Promise<string> {\n this.logger.debug('Delegating UserProviderService::getToken');\n return this.userService.getToken();\n }\n\n async updateToken(minValidity: number): Promise<boolean> {\n this.logger.debug('Delegating UserProviderService::updateToken');\n if (this.userService.updateToken) {\n return this.userService.updateToken(minValidity);\n }\n\n return new Promise(resolve => resolve(true));\n }\n\n public getEmailNotificationSettings(): Observable<EmailNotificationSettings> {\n this.logger.debug('getEmailNotificationSettings');\n return this.http.get<EmailNotificationSettings>(\n `${this.valtimoApiConfig.endpointUri}v1/email-notification-settings`\n );\n }\n\n public updateEmailNotificationSettings(\n settings: EmailNotificationSettings\n ): Observable<EmailNotificationSettings> {\n this.logger.debug('updateEmailNotificationSettings', settings);\n return this.http.put<EmailNotificationSettings>(\n `${this.valtimoApiConfig.endpointUri}v1/email-notification-settings`,\n settings\n );\n }\n}\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CSP_HTTP_EQUIV = 'Content-Security-Policy';\n\nconst CSP_META_ID = 'CSP_META';\n\nexport {CSP_HTTP_EQUIV, CSP_META_ID};\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './csp.constant';\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NGXLogger} from 'ngx-logger';\nimport {ConfigService} from '@valtimo/config';\nimport {CSP_HTTP_EQUIV, CSP_META_ID} from '../constants';\nimport {DomSanitizer} from '@angular/platform-browser';\nimport {CSPHeaderParams, getCSP} from 'csp-header';\nimport {SecurityContext} from '@angular/core';\n\nconst getSanitizedCspString = (\n cspHeaderParams: CSPHeaderParams,\n domSanitizer: DomSanitizer\n): string => {\n const csp = getCSP(cspHeaderParams);\n return domSanitizer.sanitize(SecurityContext.HTML, csp);\n};\n\nconst getCspHeaderElement = (\n cspHeaderParams: CSPHeaderParams,\n domSanitizer: DomSanitizer,\n document: Document\n): HTMLMetaElement => {\n const csp = getSanitizedCspString(cspHeaderParams, domSanitizer);\n const cspMeta = document.createElement('meta');\n\n cspMeta.httpEquiv = CSP_HTTP_EQUIV;\n cspMeta.content = csp;\n cspMeta.id = CSP_META_ID;\n\n return cspMeta;\n};\n\nconst appendElementToHead = (element: HTMLMetaElement, document: Document): void => {\n document.head.appendChild(element);\n};\n\nconst isElementLoaded = async (elementId: string, document: Document): Promise<boolean> => {\n while (document.getElementById(elementId) === null) {\n await new Promise(resolve => requestAnimationFrame(resolve));\n }\n return !!document.getElementById(elementId);\n};\n\nexport const initializeCsp =\n (\n logger: NGXLogger,\n configService: ConfigService,\n document: Document,\n domSanitizer: DomSanitizer\n ): (() => Promise<boolean>) =>\n async (): Promise<boolean> => {\n const cspHeaderParams = configService?.config?.csp;\n\n if (cspHeaderParams) {\n logger.log('Create CSP header element from:', cspHeaderParams);\n\n const cspHeaderElement = getCspHeaderElement(cspHeaderParams, domSanitizer, document);\n\n appendElementToHead(cspHeaderElement, document);\n\n return await isElementLoaded(CSP_META_ID, document);\n }\n\n logger.log('No CSP config present.');\n\n return true;\n };\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './initialize-csp';\n","/*\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Public API Surface of security\n */\nexport * from './lib/guard/auth-guard.service';\nexport * from './lib/security.module';\nexport * from './lib/error/error';\nexport * from './lib/error/error.component';\nexport * from './lib/user-provider.service';\nexport * from './lib/constants';\nexport * from './lib/initializers';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;MAWU,gBAAgB,CAAA;AAG3B,IAAA,WAAA,CACE,aAA4B,EACpB,QAAkB,EAChB,MAAiB,EAAA;QADnB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAChB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAW;AAE3B,QAAA,IAAI,CAAC,wBAAwB,GAAG,QAAQ,CAAC,GAAG,CAC1C,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,oBAAoB,CACvE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;KAC9F;IAED,WAAW,CACT,KAA6B,EAC7B,KAA0B,EAAA;AAE1B,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,C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IAAA,IAAI,eAAe,EAAE;AACnB,QAAA,MAAM,CAAC,GAAG,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;QAE/D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEtF,QAAA,mBAAmB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAEhD,QAAA,OAAO,MAAM,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACrD,KAAA;AAED,IAAA,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAErC,IAAA,OAAO,IAAI,CAAC;AACd;;AChFF;;;;;;;;;;;;;;AAcG;;ACdH;;;;;;;;;;;;;;AAcG;AAEH;;AAEG;;AClBH;;AAEG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp.constant.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/constants/csp.constant.ts"],"names":[],"mappings":"AAgBA,QAAA,MAAM,cAAc,4BAA4B,CAAC;AAEjD,QAAA,MAAM,WAAW,aAAa,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/constants/index.ts"],"names":[],"mappings":"AAgBA,cAAc,gBAAgB,CAAC"}
|
package/lib/error/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/error/error.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/error/error.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,qBAAqB,aAAgD,CAAC;AAEnF,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-error.interceptor.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/error/http-error.interceptor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,SAAS,EACT,WAAW,EACX,eAAe,EACf,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAa,MAAM,MAAM,CAAC;AAG5C,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;;AAErC,qBAGa,oBAAqB,YAAW,eAAe;IAExD,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;gBADN,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,SAAS;IAG3B,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;yCANxE,oBAAoB;6CAApB,oBAAoB;
|
|
1
|
+
{"version":3,"file":"http-error.interceptor.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/error/http-error.interceptor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,SAAS,EACT,WAAW,EACX,eAAe,EACf,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAa,MAAM,MAAM,CAAC;AAG5C,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;;AAErC,qBAGa,oBAAqB,YAAW,eAAe;IAExD,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;gBADN,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,SAAS;IAG3B,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;yCANxE,oBAAoB;6CAApB,oBAAoB;CAoDhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/initializers/index.ts"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NGXLogger } from 'ngx-logger';
|
|
2
|
+
import { ConfigService } from '@valtimo/config';
|
|
3
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
export declare const initializeCsp: (logger: NGXLogger, configService: ConfigService, document: Document, domSanitizer: DomSanitizer) => (() => Promise<boolean>);
|
|
5
|
+
//# sourceMappingURL=initialize-csp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize-csp.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/initializers/initialize-csp.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAsCvD,eAAO,MAAM,aAAa,WAEd,SAAS,iBACF,aAAa,YAClB,QAAQ,gBACJ,YAAY,KACzB,CAAC,MAAM,QAAQ,OAAO,CAAC,CAiBzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/interceptors/index.ts"],"names":[],"mappings":"AAgBA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ZoneOffsetInterceptor implements HttpInterceptor {
|
|
5
|
+
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
|
|
6
|
+
private getFormattedZoneOffset;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZoneOffsetInterceptor, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZoneOffsetInterceptor>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=zone-offset.interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone-offset.interceptor.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/security/src/lib/interceptors/zone-offset.interceptor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;;AAGhC,qBACa,qBAAsB,YAAW,eAAe;IACpD,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAOtF,OAAO,CAAC,sBAAsB;yCARnB,qBAAqB;6CAArB,qBAAqB;CAsBjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/security/src/lib/security.module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"security.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/security/src/lib/security.module.ts"],"names":[],"mappings":";;;AAuBA,qBASa,cAAc;yCAAd,cAAc;0CAAd,cAAc;0CAAd,cAAc;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valtimo/security",
|
|
3
3
|
"license": "EUPL-1.2",
|
|
4
|
-
"version": "11.1
|
|
4
|
+
"version": "11.2.1",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^16.2.0",
|
|
7
7
|
"@angular/core": "^16.2.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"ngx-toastr": "17.0.2",
|
|
11
|
-
"tslib": "2.6.2"
|
|
11
|
+
"tslib": "2.6.2",
|
|
12
|
+
"moment": "2.29.4"
|
|
12
13
|
},
|
|
13
14
|
"module": "fesm2022/valtimo-security.mjs",
|
|
14
15
|
"typings": "index.d.ts",
|
package/public_api.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export * from './lib/security.module';
|
|
|
3
3
|
export * from './lib/error/error';
|
|
4
4
|
export * from './lib/error/error.component';
|
|
5
5
|
export * from './lib/user-provider.service';
|
|
6
|
+
export * from './lib/constants';
|
|
7
|
+
export * from './lib/initializers';
|
|
6
8
|
//# sourceMappingURL=public_api.d.ts.map
|
package/public_api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/security/src/public_api.ts"],"names":[],"mappings":"AAmBA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/security/src/public_api.ts"],"names":[],"mappings":"AAmBA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|