mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
fix(handle_jwt.py): enable user to set jwt admin scope string in config
This commit is contained in:
parent
d2d6f6d0aa
commit
d3e7376e10
2 changed files with 11 additions and 7 deletions
|
@ -67,17 +67,21 @@ class JWTHandler:
|
|||
self.http_handler = HTTPHandler()
|
||||
|
||||
def update_environment(
|
||||
self, prisma_client: Optional[PrismaClient], user_api_key_cache: DualCache
|
||||
self,
|
||||
prisma_client: Optional[PrismaClient],
|
||||
user_api_key_cache: DualCache,
|
||||
litellm_proxy_roles: LiteLLMProxyRoles,
|
||||
) -> None:
|
||||
self.prisma_client = prisma_client
|
||||
self.user_api_key_cache = user_api_key_cache
|
||||
self.litellm_proxy_roles = litellm_proxy_roles
|
||||
|
||||
def is_jwt(self, token: str):
|
||||
parts = token.split(".")
|
||||
return len(parts) == 3
|
||||
|
||||
def is_admin(self, scopes: list) -> bool:
|
||||
if LiteLLMProxyRoles.PROXY_ADMIN.value in scopes:
|
||||
if self.litellm_proxy_roles.PROXY_ADMIN in scopes:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue