Skip to content

Commit

Permalink
get guest token from header instead of cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
suddjian committed Dec 11, 2021
1 parent df2f49a commit bcba0fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument
GUEST_ROLE_NAME = "Public"
GUEST_TOKEN_JWT_SECRET = "test-guest-secret-change-me"
GUEST_TOKEN_JWT_ALGO = "HS256"
GUEST_TOKEN_COOKIE_NAME = "__guest_token__"
GUEST_TOKEN_HEADER_NAME = "X-GuestToken"
GUEST_TOKEN_JWT_EXP_SECONDS = 300 # 5 minutes

# A SQL dataset health check. Note if enabled it is strongly advised that the callable
Expand Down
2 changes: 1 addition & 1 deletion superset/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ def get_guest_user(self, req: Request) -> Optional[GuestUser]:
:return: A guest user object
"""
raw_token = req.cookies.get(current_app.config["GUEST_TOKEN_COOKIE_NAME"])
raw_token = req.headers.get(current_app.config["GUEST_TOKEN_HEADER_NAME"])
if raw_token is None:
return None

Expand Down

0 comments on commit bcba0fa

Please sign in to comment.