+
    yj'                     B   ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RIH
t
 ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt Rt]P.                  ! ]4      tRR ltRR ltRR lt ! R R]4      t ! R R4      t ! R R]4      tR t R# )    N)urlparse)	Blueprint)current_app)g)request)session)BadData)SignatureExpired)URLSafeTimedSerializer)
BadRequest)ValidationError)CSRFCSRFProtectc                |   \        V R\        P                  RR7      p \        VRRRR7      pV\        9  d   \	        V RR7      pV\
        9  d@   \        P                  ! \        P                  ! ^@4      4      P                  4       \
        V&    VP                  \
        V,          4      p\        \        W$4       \        P                  ! V4      #   \         d_    \        P                  ! \        P                  ! ^@4      4      P                  4       \
        T&   TP                  \
        T,          4      p Li ; i)	a  Generate a CSRF token. The token is cached for a request, so multiple
calls to this function will generate the same token.

During testing, it might be useful to access the signed token in
``g.csrf_token`` and the raw token in ``session['csrf_token']``.

:param secret_key: Used to securely sign the token. Default is
    ``WTF_CSRF_SECRET_KEY`` or ``SECRET_KEY``.
:param token_key: Key where token is stored in session for comparison.
    Default is ``WTF_CSRF_FIELD_NAME`` or ``'csrf_token'``.
WTF_CSRF_SECRET_KEY%A secret key is required to use CSRF.messageWTF_CSRF_FIELD_NAME
csrf_token%A field name is required to use CSRF.wtf-csrf-tokensalt)_get_configr   
secret_keyr   r   r   hashlibsha1osurandom	hexdigestdumps	TypeErrorsetattrget)r   	token_key
field_namestokens   &&   B/var/www/html/2rare/lib/python3.14/site-packages/flask_wtf/csrf.pygenerate_csrfr+      s     7	J 7	J ":4DEW$"),,rzz"~">"H"H"JGJ	1GGGJ/0E
 	:%55  	1"),,rzz"~">"H"H"JGJGGGJ/0E	1s   C A&D;:D;c                   \        VR\        P                  RR7      p\        VRRRR7      p\        VRRR	R
7      pV '       g   \        R4      hV\        9  d   \        R4      h\        VRR7      p VP                  WR7      p\        P                  ! \        T,          T4      '       g   \        R4      hR#   \         d   p\        R4      ThRp?i\         d   p\        R4      ThRp?ii ; i)a  Check if the given data is a valid CSRF token. This compares the given
signed token to the one stored in the session.

:param data: The signed CSRF token to be checked.
:param secret_key: Used to securely sign the token. Default is
    ``WTF_CSRF_SECRET_KEY`` or ``SECRET_KEY``.
:param time_limit: Number of seconds that the token is valid. Default is
    ``WTF_CSRF_TIME_LIMIT`` or 3600 seconds (60 minutes).
:param token_key: Key where token is stored in session for comparison.
    Default is ``WTF_CSRF_FIELD_NAME`` or ``'csrf_token'``.

:raises ValidationError: Contains the reason that validation failed.

.. versionchanged:: 0.14
    Raises ``ValidationError`` with a specific error message rather than
    returning ``True`` or ``False``.
r   r   r   r   r   r   WTF_CSRF_TIME_LIMIT  F)requiredzThe CSRF token is missing.z"The CSRF session token is missing.r   r   )max_agezThe CSRF token has expired.NzThe CSRF token is invalid.zThe CSRF tokens do not match.)r   r   r   r   r   r   loadsr
   r	   hmaccompare_digest)datar   
time_limitr&   r'   r(   r)   es   &&&&    r*   validate_csrfr7   B   s    & 7	J 7	J Z)>uUJ:;; BCCz0@AAC1 wz2E::=>> ;  D;<!C C:;BCs*   3B: :C0CC0C0C++C0c                z    V f    \         P                  P                  W4      p V'       d   V f   \        V4      hV # )a  Find config value based on provided value, Flask config, and default
value.

:param value: already provided config value
:param config_name: Flask ``config`` key
:param default: default value if not provided or configured
:param required: whether the value must not be ``None``
:param message: error message if required config is not found
:raises KeyError: if required config is not found
)r   configr%   RuntimeError)valueconfig_namedefaultr/   r   s   &&&&&r*   r   r   v   s6     }""&&{<EM7##L    c                   >   a a ] tR t^t oV 3R ltR tR tRtVtV ;t	# )_FlaskFormCSRFc                D   < VP                   V n         \        SV `	  V4      # N)metasuper
setup_form)selfform	__class__s   &&r*   rE   _FlaskFormCSRF.setup_form   s    II	w!$''r>   c                l    \        V P                  P                  V P                  P                  R 7      # ))r   r&   )r+   rC   csrf_secretcsrf_field_name)rF   csrf_token_fields   &&r*   generate_csrf_token"_FlaskFormCSRF.generate_csrf_token   s(    yy,,		8Q8Q
 	
r>   c                b   \         P                  ! R R4      '       d   R#  \        VP                  V P                  P
                  V P                  P                  V P                  P                  4       R#   \         d-   p\        P                  TP                  ^ ,          4       h Rp?ii ; i)
csrf_validFN)r   r%   r7   r4   rC   rK   csrf_time_limitrL   r   loggerinfoargs)rF   rG   fieldr6   s   &&& r*   validate_csrf_token"_FlaskFormCSRF.validate_csrf_token   sz    55u%%		

		%%		))		))	  	KKq	"	s   AA7 7B.'B))B.)rC   )
__name__
__module____qualname____firstlineno__rE   rN   rW   __static_attributes____classdictcell____classcell__)rH   __classdict__s   @@r*   r@   r@      s     (

 r>   r@   c                   L   a  ] tR t^t o RtR
R ltR tR tR tR t	R t
R	tV tR# )r   a;  Enable CSRF protection globally for a Flask app.

::

    app = Flask(__name__)
    csrf = CSRFProtect(app)

Checks the ``csrf_token`` field sent with forms, or the ``X-CSRFToken``
header sent with JavaScript requests. Render the token in templates using
``{{ csrf_token() }}``.

See the :ref:`csrf` documentation.
Nc                x    \        4       V n        \        4       V n        V'       d   V P                  V4       R # R # rB   )set_exempt_views_exempt_blueprintsinit_app)rF   apps   &&r*   __init__CSRFProtect.__init__   s*     U"%%MM# r>   c                n  a a S SP                   R &   SP                  P                  RR4       SP                  P                  RR4       \        SP                  P	                  R. RO4      4      SP                  R&   SP                  P                  RR4       SP                  P                  RRR	.4       SP                  P                  R
R4       SP                  P                  RR4       \
        SP                  P                  R&   SP                  R 4       SP                  VV 3R l4       pR# )csrfWTF_CSRF_ENABLEDTWTF_CSRF_CHECK_DEFAULTWTF_CSRF_METHODSr   r   WTF_CSRF_HEADERSzX-CSRFTokenzX-CSRF-Tokenr-   r.   WTF_CSRF_SSL_STRICTc                      R \         /# )r   )r+    r>   r*   <lambda>&CSRFProtect.init_app.<locals>.<lambda>   s	    |]&Cr>   c                    < SP                   R ,          '       g   R# SP                   R,          '       g   R# \        P                  SP                   R,          9  d   R# \        P                  '       g   R# \        P                  SP
                  9   d   R# SP                  P                  \        P                  4      p V P                   RV P                   2pVSP                  9   d   R# SP                  4        R# )rl   Nrm   rn   .)r9   r   methodendpoint	blueprintre   view_functionsr%   rZ   rY   rd   protect)viewdestrg   rF   s     r*   csrf_protect*CSRFProtect.init_app.<locals>.csrf_protect   s    ::011::677~~SZZ0B%CC###  D$;$;;%%))'*:*:;Doo&a7Dt)))LLNr>   N)POSTPUTPATCHDELETE)

extensionsr9   
setdefaultrc   r%   r+   	jinja_envglobalscontext_processorbefore_request)rF   rg   r~   s   ff r*   rf   CSRFProtect.init_app   s    !%v

0$7

6=),JJNN-/QR*


%& 	

3\B

0=.2QR

3T:

3T:.;l+CD				 
	r>   c                   \         P                  R ,          p\        P                  P	                  V4      pV'       d   V# \        P                   F?  pVP                  V4      '       g   K  \        P                  V,          pV'       g   K=  Vu # 	  \         P                  R,           F.  p\        P                  P	                  V4      pV'       g   K,  Vu # 	  R# )r   ro   N)r   r9   r   rG   r%   endswithheaders)rF   r'   
base_tokenkeyr   header_names   &     r*   _get_csrf_tokenCSRFProtect._get_csrf_token   s     ''(=>
\\%%j1
 <<C||J''$\\#.
:%%   '--.@AAK ,,[9Jz!!	 B r>   c                   \         P                  \        P                  R ,          9  d   R#  \	        V P                  4       4       \         P                  '       d   \        P                  R,          '       dm   \         P                  '       g   V P                  R4       R\         P                   R2p\        \         P                  V4      '       g   V P                  R4       R\        n        R#   \         dT   p\        P                  TP                  ^ ,          4       T P                  TP                  ^ ,          4        Rp?ELRp?ii ; i)rn   Nrp   zThe referrer header is missing.zhttps:///z%The referrer does not match the host.T)r   rw   r   r9   r7   r   r   rS   rT   rU   _error_response	is_securereferrerhostsame_originr   rQ   )rF   r6   good_referrers   &  r*   r{   CSRFProtect.protect   s    >>!3!34F!GG	,$..01
 !3!34I!J!J###$$%FG&w||nA6Mw//??$$%LM  	,KKq	"  ++	,s   C3 3E>AEEc                6   \        V\        4      '       d(   V P                  P                  VP                  4       V# \        V\
        4      '       d   TpM'RP                  VP                  VP                  34      pV P                  P                  V4       V# )zMark a view or blueprint to be excluded from CSRF protection.

::

    @app.route('/some-view', methods=['POST'])
    @csrf.exempt
    def some_view():
        ...

::

    bp = Blueprint(...)
    csrf.exempt(bp)

rv   )

isinstancer   re   addnamestrjoinrZ   rY   rd   )rF   r|   view_locations   && r*   exemptCSRFProtect.exempt  st    " dI&&##''		2KdC   MHHdoot}}%EFM}-r>   c                    \        V4      hrB   )	CSRFError)rF   reasons   &&r*   r   CSRFProtect._error_response2  s    r>   )re   rd   rB   )rY   rZ   r[   r\   __doc__rh   rf   r   r{   r   r   r]   r^   )r`   s   @r*   r   r      s.     'R2*:   r>   c                       ] tR tRtRtRtRtR# )r   i6  zRaise if the client sends invalid CSRF data with the request.

Generates a 400 Bad Request response with the failure reason by default.
Customize the response by registering a handler with
:meth:`flask.Flask.errorhandler`.
zCSRF validation failed.rr   N)rY   rZ   r[   r\   r   descriptionr]   rr   r>   r*   r   r   6  s     ,Kr>   r   c                     \        V 4      p\        V4      pVP                  VP                  8H  ;'       d;    VP                  VP                  8H  ;'       d    VP                  VP                  8H  # rB   )r   schemehostnameport)current_uricompare_uricurrentcompares   &&  r*   r   r   A  se    {#G{#G 	'..( 	) 	) 0 00	) 	)LLGLL(r>   )r+   r7   r   )NN)NNN)NTzCSRF is not configured.)!r   r2   loggingr   urllib.parser   flaskr   r   r   r   r   itsdangerousr	   r
   r   werkzeug.exceptionsr   wtformsr   wtforms.csrf.corer   __all__	getLoggerrY   rS   r+   r7   r   r@   r   r   r   rr   r>   r*   <module>r      s       	 !        ) / * # "
;			8	$(V1?h.T 6K  K \,
 ,r>   