
    +dL	                     f    d dl mZ  G d de          Z G d de          Z G d de          ZdS )	   )DictSerialiseMixinc                       e Zd ZdS )AuthenticationFailureN)__name__
__module____qualname__     0lib/python3.11/site-packages/intake/auth/base.pyr   r      s        Dr
   r   c                   ,    e Zd ZdZd Zd Zd ZddZdS )BaseAuthzBase class for authorization

    Subclass this and override the methods to implement a new type of auth.

    This basic class allows all access.
    c                     || _         d S Nargsselfr   s     r   __init__zBaseAuth.__init__       			r
   c                     dS )zIs the requests header given allowed to talk to the server

        Parameters
        ----------
        header: dict
            The HTTP header from the incoming request
        Tr	   )r   headers     r   allow_connectzBaseAuth.allow_connect   s	     tr
   c                     dS )a_  Is the given HTTP header allowed to access given data source

        Parameters
        ----------
        header: dict
            The HTTP header from the incoming request
        source: CatalogEntry
            The data source the user wants to access.
        catalog: Catalog
            The catalog object containing this data source.
        Tr	   )r   r   sourcecatalogs       r   allow_accesszBaseAuth.allow_access$   s	     tr
   Nc                     |                                 }|                                D ]!\  }}||                                 k    r|c S "|S )z~Case-insensitive search of a dictionary for key.

        Returns the value if key match is found, otherwise default.
        )loweritems)r   
dictionarykeydefault	lower_keykvs          r   get_case_insensitivezBaseAuth.get_case_insensitive2   sZ    
 IIKK	$$&& 	 	DAqAGGII%  Nr
   r   )r   r   r   __doc__r   r   r   r&   r	   r
   r   r   r      s_               
 
 
 
 
 
r
   r   c                   @    e Zd ZdZd Zd Zed             Zd Zd Z	dS )BaseClientAuthzBase class for client-side setting of authorization headers

    This basic class adds no headers to remote catalog reqests
    c                     || _         d S r   r   r   s     r   r   zBaseClientAuth.__init__E   r   r
   c                      t          |           S r   )hashr   s    r   __dask_tokenize__z BaseClientAuth.__dask_tokenize__H   s    Dzzr
   c                 X    ddl m}  |t          |           j        | j        d          S )N    )tokenize)clsr   )	dask.baser1   typer   r   )r   r1   s     r   _tokzBaseClientAuth._tokK   s7    &&&&&&xT

 3TYGGHHHr
   c                 ,    t          | j        d          S )N   )intr5   r-   s    r   __hash__zBaseClientAuth.__hash__Q   s    49b!!!r
   c                     i S )zDReturns a dictionary of HTTP headers for the remote catalog request.r	   r-   s    r   get_headerszBaseClientAuth.get_headersT   s    	r
   N)
r   r   r   r'   r   r.   propertyr5   r9   r;   r	   r
   r   r)   r)   ?   sx         
     I I XI
" " "    r
   r)   N)utilsr   	Exceptionr   r   objectr)   r	   r
   r   <module>r@      s    ' & & & & &	 	 	 	 	I 	 	 	- - - - -! - - -`    V     r
   