mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-28 03:10:24 +00:00
feat: basic implementation and usage of Credentials API for MCP
This commit is contained in:
parent
b43cdaaed5
commit
6e57929ede
8 changed files with 280 additions and 45 deletions
|
|
@ -209,11 +209,15 @@ def create_dynamic_typed_route(func: Any, method: str, route: str):
|
|||
async def endpoint(request: Request, **kwargs):
|
||||
# Get auth attributes from the request scope
|
||||
user_attributes = request.scope.get("user_attributes", {})
|
||||
principal = request.scope.get("principal", None)
|
||||
|
||||
await log_request_pre_validation(request)
|
||||
|
||||
# TODO: before request execution starts, we need to check for authorization
|
||||
# so we can send back 40X errors before StreamingResponse starts (and returns a 200).
|
||||
|
||||
# Use context manager with both provider data and auth attributes
|
||||
with request_provider_data_context(request.headers, user_attributes):
|
||||
with request_provider_data_context(request.headers, user_attributes, principal):
|
||||
is_streaming = is_streaming_request(func.__name__, request, **kwargs)
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue