Skip to content

Commit 227910a

Browse files
authored
Merge branch 'main' into bugfix-adk-sessions
2 parents 2e0ee03 + 695171d commit 227910a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/lightspeed_agent/auth/middleware.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from starlette.responses import JSONResponse
1111

1212
from lightspeed_agent.auth.introspection import (
13+
DisallowedScopeError,
1314
InsufficientScopeError,
1415
TokenValidationError,
1516
get_token_introspector,
@@ -123,6 +124,9 @@ async def dispatch(
123124
_request_access_token.set((token, user.token_exp))
124125
_request_order_id.set(order_id)
125126
logger.debug("Authenticated user: %s", user.user_id)
127+
except DisallowedScopeError as e:
128+
logger.warning("Disallowed scope: %s", e)
129+
return self._forbidden_response(str(e))
126130
except InsufficientScopeError as e:
127131
logger.warning("Insufficient scope: %s", e)
128132
return self._forbidden_response(str(e))

0 commit comments

Comments
 (0)