Format: application/x-python-code
1 o
2
3 G'h� � @ s\ d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
4 Z
5 dedefd d
6 �Zdedede
7 fd
8 d�Zdefdd�Zdedefdd�Zdededefdd�Zdedefdd�Zdedefdd�Zdededefdd�Zdededefdd �Zd!ededefd"d#�Zd!ed$ede
9 fd%d&�Zd!ed$edefd'd(�Zdededefd)d*�Zd+edefd,d-�Zd.S )/a�
10 These are the default methods implementations that are used in this extension.
11 All of these can be updated on an app by app basis using the JWTManager
12 loader decorators. For further information, check out the following links:
13
14 http://flask-jwt-extended.readthedocs.io/en/latest/changing_default_behavior.html
15 http://flask-jwt-extended.readthedocs.io/en/latest/tokens_from_complex_object.html
16 � )�
17 HTTPStatus)�Any)�jsonify)�ResponseReturnValue)�config�userdata�returnc C � i S )z�
18 By default, we add no additional claims to the access tokens.
19
20 :param userdata: data passed in as the ```identity``` argument to the
21 ```create_access_token``` and ```create_refresh_token```
22 functions
23 � �r r
24 r
25 �ZC:\Users\shubh\Videos\agent\nova\Lib\site-packages\flask_jwt_extended/default_callbacks.py�"default_additional_claims_callback � r
26 �jwt_headers�jwt_datac C � dS )NFr
27 )r r r
28 r
29 r �default_blocklist_callback s r c C r )aG
30 By default header typically consists of two parts: the type of the token,
31 which is JWT, and the signing algorithm being used, such as HMAC SHA256
32 or RSA. But we don't set the default header here we set it as empty which
33 further by default set while encoding the token
34 :return: default we set None here
35 r
36 )�default_headersr
37 r
38 r �default_jwt_headers_callback! r r c C s | S )a)
39 By default, we use the passed in object directly as the jwt identity.
40 See this for additional info:
41
42 :param userdata: data passed in as the ```identity``` argument to the
43 ```create_access_token``` and ```create_refresh_token```
44 functions
45 r
46 r r
47 r
48 r �default_user_identity_callback, s r �_expired_jwt_header�_expired_jwt_datac C � t tjdi�tjfS )z�
49 By default, if an expired token attempts to access a protected endpoint,
50 we return a generic error message with a 401 status
51 zToken has expired�r r �
52 error_msg_keyr �UNAUTHORIZED)r r r
53 r
54 r �default_expired_token_callback8 � r �error_stringc C � t tj| i�tjfS )z�
55 By default, if an invalid token attempts to access a protected endpoint, we
56 return the error string for why it is not valid with a 422 status code
57
58 :param error_string: String indicating why the token is invalid
59 )r r r r �UNPROCESSABLE_ENTITY�r r
60 r
61 r �default_invalid_token_callbackB � �r"