
    E2is                         d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ  G d	 d
e          ZdS )    )Optional)Doc)OpenIdConnect)SecurityBase)HTTPException)Request)HTTP_401_UNAUTHORIZED)	Annotatedc                       e Zd ZdZdddddee ed          f         deee          ed          f         d	eee          ed
          f         dee ed          f         fdZ	de
fdZdedee         fdZdS )r   as  
    OpenID Connect authentication class. An instance of it would be used as a
    dependency.

    **Warning**: this is only a stub to connect the components with OpenAPI in FastAPI,
    but it doesn't implement the full OpenIdConnect scheme, for example, it doesn't use
    the OpenIDConnect URL. You would need to to subclass it and implement it in your
    code.
    NT)scheme_namedescription
auto_erroropenIdConnectUrlz1
            The OpenID Connect URL.
            r   z
                Security scheme name.

                It will be included in the generated OpenAPI (e.g. visible at `/docs`).
                r   z
                Security scheme description.

                It will be included in the generated OpenAPI (e.g. visible at `/docs`).
                r   a  
                By default, if no HTTP Authorization header is provided, required for
                OpenID Connect authentication, it will automatically cancel the request
                and send the client an error.

                If `auto_error` is set to `False`, when the HTTP Authorization header
                is not available, instead of erroring out, the dependency result will
                be `None`.

                This is useful when you want to have optional authentication.

                It is also useful when you want to have authentication that can be
                provided in one of multiple optional ways (for example, with OpenID
                Connect or in a cookie).
                c                f    t          ||          | _        |p| j        j        | _        || _        d S )N)r   r   )OpenIdConnectModelmodel	__class____name__r   r   )selfr   r   r   r   s        c/var/www/html/pixcura-vrs/venv/lib/python3.11/site-packages/fastapi/security/open_id_connect_url.py__init__zOpenIdConnect.__init__   s?    h (-;
 
 

 'A$.*A$    returnc                 4    t          t          dddi          S )NzNot authenticatedzWWW-AuthenticateBearer)status_codedetailheaders)r   r	   )r   s    r   make_not_authenticated_errorz*OpenIdConnect.make_not_authenticated_errorQ   s'    -&'2
 
 
 	
r   requestc                 |   K   |j                             d          }|s| j        r|                                 d S |S )NAuthorization)r   getr   r   )r   r    authorizations      r   __call__zOpenIdConnect.__call__X   sJ      ++O<< 	 77999tr   )r   
__module____qualname____doc__r
   strr   r   boolr   r   r   r   r%    r   r   r   r      sB        <  ( e8% 8% 8% $C 
8% SMC 	
8%* SMC 	
+8%> C 
?8% 8% 8% 8%t
m 
 
 
 
g (3-      r   r   N)typingr   annotated_docr   fastapi.openapi.modelsr   r   fastapi.security.baser   starlette.exceptionsr   starlette.requestsr   starlette.statusr	   typing_extensionsr
   r+   r   r   <module>r4      s                F F F F F F . . . . . . . . . . . . & & & & & & 2 2 2 2 2 2 ' ' ' ' ' 'S S S S SL S S S S Sr   