chore: support different JWT CSRF cookie names (#25891)
This commit is contained in:
parent
5def416f63
commit
007d22199d
|
|
@ -18,13 +18,18 @@
|
|||
*/
|
||||
import { SupersetClient, logging, ClientConfig } from '@superset-ui/core';
|
||||
import parseCookie from 'src/utils/parseCookie';
|
||||
import getBootstrapData from 'src/utils/getBootstrapData';
|
||||
|
||||
const bootstrapData = getBootstrapData();
|
||||
|
||||
function getDefaultConfiguration(): ClientConfig {
|
||||
const csrfNode = document.querySelector<HTMLInputElement>('#csrf_token');
|
||||
const csrfToken = csrfNode?.value;
|
||||
|
||||
// when using flask-jwt-extended csrf is set in cookies
|
||||
const cookieCSRFToken = parseCookie().csrf_access_token || '';
|
||||
const jwtAccessCsrfCookieName =
|
||||
bootstrapData.common.conf.JWT_ACCESS_CSRF_COOKIE_NAME;
|
||||
const cookieCSRFToken = parseCookie()[jwtAccessCsrfCookieName] || '';
|
||||
|
||||
return {
|
||||
protocol: ['http:', 'https:'].includes(window?.location?.protocol)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ FRONTEND_CONF_KEYS = (
|
|||
"ALERT_REPORTS_DEFAULT_WORKING_TIMEOUT",
|
||||
"NATIVE_FILTER_DEFAULT_ROW_LIMIT",
|
||||
"PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET",
|
||||
"JWT_ACCESS_CSRF_COOKIE_NAME",
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
Loading…
Reference in New Issue