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

Merged
merged 1 commit into from
May 4, 2025
Merged
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
7 changes: 6 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,11 @@ def __call__(
algorithms=["HS256", "RS256"],
)
elif bearer_token is not None:
if settings.environment != "develop":
try:
await fief.validate_access_token(bearer_token.credentials)
except Exception:
raise HTTPException(status_code=401, detail="Invalid token")
# cli user using fief token
self.auth_user = jwt.decode(
bearer_token.credentials,
Expand Down
Loading