mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[AAE-12501] Comment temporary setCsrfToken because is not possible to import app config service from core due to circular dependencies
This commit is contained in:
@@ -274,26 +274,26 @@ export class AdfHttpClient implements ee.Emitter,JsApiHttpClient {
|
|||||||
if (!this.disableCsrf) {
|
if (!this.disableCsrf) {
|
||||||
this.setCsrfToken(optionsHeaders);
|
this.setCsrfToken(optionsHeaders);
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
return new HttpHeaders(optionsHeaders);
|
return new HttpHeaders(optionsHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
private setCsrfToken(optionsHeaders: any) {
|
// private setCsrfToken(optionsHeaders: any) {
|
||||||
const token = this.createCSRFToken();
|
// const token = this.createCSRFToken();
|
||||||
optionsHeaders['X-CSRF-TOKEN'] = token;
|
// optionsHeaders['X-CSRF-TOKEN'] = token;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
document.cookie = 'CSRF-TOKEN=' + token + ';path=/';
|
// document.cookie = 'CSRF-TOKEN=' + token + ';path=/';
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
/* continue regardless of error */
|
// /* continue regardless of error */
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private createCSRFToken(a?: any): string {
|
// private createCSRFToken(a?: any): string {
|
||||||
const randomValue = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
// const randomValue = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||||
return a ? (a ^ ((randomValue * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);
|
// return a ? (a ^ ((randomValue * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private static getResponseType(options: RequestOptions): 'blob' | 'json' | 'text' {
|
private static getResponseType(options: RequestOptions): 'blob' | 'json' | 'text' {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user