
    3iY                     |    S SK Jr  S SKJr  S SKJr  S SKJrJrJ	r	J
r
Jr  S SKJr   " S S\	5      r " S S	\
5      rg
)    )Dict)HTTPException)override)AuthzActionAuthzResourceServerAuthenticationProviderServerAuthorizationProviderUserIdentity)Systemc                   >    \ rS rSrSr\S\\\4   S\4S j5       r	Sr
g)ExampleAuthenticationProvider   zIn practice the tenant would likely be resolved from some other opaque value (e.g. key/token). Here, it's just passed directly as a header for simplicity.headersreturnc                 6    [        SUR                  SS 5      S9$ )Ntestzx-tenant)user_idtenant)r
   get)selfr   s     h/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/test/client/test_database_tenant_auth.pyauthenticate_or_raise3ExampleAuthenticationProvider.authenticate_or_raise   s     ;;z40
 	
     N)__name__
__module____qualname____firstlineno____doc__r   r   strr
   r   __static_attributes__r   r   r   r   r      s0     e
T#s(^ 
 
 
r   r   c            	       \   ^  \ rS rSrSrS\SS4U 4S jjr\S\S\	S	\
SS4S
 j5       rSrU =r$ )ExampleAuthorizationProvider   zUA simple authz provider that asserts the user's tenant matches the resource's tenant.systemr   Nc                 F   > [         TU ]  U5        UR                  U l        g )N)super__init__settings	_settings)r   r&   	__class__s     r   r)   %ExampleAuthorizationProvider.__init__   s     r   useractionresourcec                     UR                   c  g U[        R                  :X  a  g UR                   UR                   :w  a
  [        SSS9eg )Ni  Unauthorized)status_codedetail)r   r   RESETr   )r   r.   r/   r0   s       r   authorize_or_raise/ExampleAuthorizationProvider.authorize_or_raise    sD     ;;[&&&;;(//)CGG *r   )r+   )r   r   r   r   r    r   r)   r   r
   r   r   r6   r"   __classcell__)r,   s   @r   r$   r$      sS    _)v )$ ) 
H 
H*5
HAN
H	
H 
Hr   r$   N)typingr   fastapir   	overridesr   chromadb.authr   r   r   r	   r
   chromadb.configr   r   r$   r   r   r   <module>r>      s9     !   #
$@ 
H#> Hr   