o
    {Ð,h¼  ã                   @   s0   d Z ddlmZ ddlmZ G dd„ deƒZdS )z°
Clickjacking Protection Middleware.

This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
é    )Úsettings)ÚMiddlewareMixinc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚXFrameOptionsMiddlewareaî  
    Set the X-Frame-Options HTTP header in HTTP responses.

    Do not set the header if it's already set or if the response contains
    a xframe_options_exempt value set to True.

    By default, set the X-Frame-Options header to 'DENY', meaning the response
    cannot be displayed in a frame, regardless of the site attempting to do so.
    To enable the response to be loaded on a frame within the same site, set
    X_FRAME_OPTIONS in your project's Django settings to 'SAMEORIGIN'.
    c                 C   s8   |  d¡d ur	|S t|ddƒr|S |  ||¡|jd< |S )NzX-Frame-OptionsÚxframe_options_exemptF)ÚgetÚgetattrÚget_xframe_options_valueÚheaders©ÚselfÚrequestÚresponse© r   úT/var/www/html/rh/venv/lib/python3.10/site-packages/django/middleware/clickjacking.pyÚprocess_response   s   
þz(XFrameOptionsMiddleware.process_responsec                 C   s   t tddƒ ¡ S )a  
        Get the value to set for the X_FRAME_OPTIONS header. Use the value from
        the X_FRAME_OPTIONS setting, or 'DENY' if not set.

        This method can be overridden if needed, allowing it to vary based on
        the request or response.
        ÚX_FRAME_OPTIONSÚDENY)r   r   Úupperr
   r   r   r   r   (   s   z0XFrameOptionsMiddleware.get_xframe_options_valueN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    r   N)r   Údjango.confr   Údjango.utils.deprecationr   r   r   r   r   r   Ú<module>   s    