Skip to content

fix(carbonserver) validate fief token #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion carbonserver/carbonserver/api/services/auth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, error_if_not_found=False):
"""
self.error_if_not_found = error_if_not_found

def __call__(
async def __call__(
self,
auth_user_cookie: Optional[FiefUserInfo] = Depends(
fief_auth_cookie.current_user(optional=True)
Expand All @@ -85,6 +85,9 @@ def __call__(
algorithms=["HS256", "RS256"],
)
elif bearer_token is not None:
if settings.environment != "develop":
await fief.validate_access_token(bearer_token.credentials)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws an exception if not valid, see in its docs --> https://github.com/fief-dev/fief-python/blob/main/fief_client/client.py#L655-L662

Maybe we can catch it and throw a 401?


# cli user using fief token
self.auth_user = jwt.decode(
bearer_token.credentials,
Expand Down
Loading