forked from phoenix/litellm-mirror
feat(auth_checks.py): enable admin to enforce 'user' param for all openai endpoints
This commit is contained in:
parent
9b7383ac67
commit
4eb93832e4
4 changed files with 41 additions and 1 deletions
|
@ -440,6 +440,8 @@ async def user_api_key_auth(
|
|||
request_body=request_data,
|
||||
team_object=team_object,
|
||||
end_user_object=end_user_object,
|
||||
general_settings=general_settings,
|
||||
route=route,
|
||||
)
|
||||
# save user object in cache
|
||||
await user_api_key_cache.async_set_cache(
|
||||
|
@ -867,6 +869,23 @@ async def user_api_key_auth(
|
|||
f"ExceededTokenBudget: Current Team Spend: {valid_token.team_spend}; Max Budget for Team: {valid_token.team_max_budget}"
|
||||
)
|
||||
|
||||
# Check 8: Additional Common Checks across jwt + key auth
|
||||
_team_obj = LiteLLM_TeamTable(
|
||||
team_id=valid_token.team_id,
|
||||
max_budget=valid_token.team_max_budget,
|
||||
spend=valid_token.team_spend,
|
||||
tpm_limit=valid_token.team_tpm_limit,
|
||||
rpm_limit=valid_token.team_rpm_limit,
|
||||
blocked=valid_token.team_blocked,
|
||||
models=valid_token.team_models,
|
||||
)
|
||||
_ = common_checks(
|
||||
request_body=request_data,
|
||||
team_object=_team_obj,
|
||||
end_user_object=None,
|
||||
general_settings=general_settings,
|
||||
route=route,
|
||||
)
|
||||
# Token passed all checks
|
||||
api_key = valid_token.token
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue