
    hje                    j    d Z ddlmZ ddlZ ej        e          ZddlmZ dZ	 G d de          Z
dS )zI Provide a mixin class to add authorization hooks to a request handler.

    )annotationsN)RequestHandler)AuthRequestHandlerc                  $    e Zd ZdZd Zd Zd ZdS )r   z This mixin adds the expected Tornado authorization hooks:

    * get_login_url
    * get_current_user
    * prepare

    All of these delegate to the a :class:`~bokeh.serve.auth_provider.AuthProvider`
    confiured on the Bokeh tornado application.

    c                    | j         j        j        | j         j                            |           S | j         j        j        | j         j        j        S t	          d          )zm Delegates to``get_login_url`` method of the auth provider, or the
        ``login_url`` attribute.

        NzSlogin_url or get_login_url() must be supplied when authentication hooks are enabled)applicationauth_providerget_login_url	login_urlRuntimeErrorselfs    Glib/python3.11/site-packages/bokeh/server/views/auth_request_handler.pyr
   z AuthRequestHandler.get_login_url6   sZ    
 )7C#1??EEE)3?#1;;pqqq    c                f    | j         j        j        | j         j                            |           S dS )zW Delegate to the synchronous ``get_user`` method of the auth
        provider

        Ndefault_user)r   r	   get_userr   s    r   get_current_userz#AuthRequestHandler.get_current_userA   s2    
 )2>#1::4@@@~r   c                   K   | j         j        j        ,| j         j                            |            d{V | _        dS dS )z4 Async counterpart to ``get_current_user``

        N)r   r	   get_user_asynccurrent_userr   s    r   preparezAuthRequestHandler.prepareJ   sU       )8D&*&6&D&S&STX&Y&Y Y Y Y Y Y YD EDr   N)__name__
__module____qualname____doc__r
   r   r    r   r   r   r   *   sS        	 		r 	r 	r  Z Z Z Z Zr   r   )r   
__future__r   logging	getLoggerr   logtornado.webr   __all__r   r   r   r   <module>r$      s     # " " " " " g!! ' & & & & &%Z %Z %Z %Z %Z %Z %Z %Z %Z %Zr   