§
    (ê[fù  ã                   ó@   — d dl Z d dlmZ d dlmZ  G d„ d¦  «        ZdS )é    N)Ú	to_native)Újwtc                   óf   — e Zd ZdZdZdd„Zed„ ¦   «         Zed„ ¦   «         Zdd„Z	dd	„Z
	 	 dd„ZdS )ÚJWTBearerTokenGeneratora#  A JSON Web Token formatted bearer token generator for jwt-bearer grant type.
    This token generator can be registered into authorization server::

        authorization_server.register_token_generator(
            'urn:ietf:params:oauth:grant-type:jwt-bearer',
            JWTBearerTokenGenerator(private_rsa_key),
        )

    In this way, we can generate the token into JWT format. And we don't have to
    save this token into database, since it will be short time valid. Consider to
    rewrite ``JWTBearerGrant.save_token``::

        class MyJWTBearerGrant(JWTBearerGrant):
            def save_token(self, token):
                pass

    :param secret_key: private RSA key in bytes, JWK or JWK Set.
    :param issuer: a string or URI of the issuer
    :param alg: ``alg`` to use in JWT
    i  NÚRS256c                 ó0   — || _         || _        || _        d S ©N)Ú
secret_keyÚissuerÚalg)Úselfr
   r   r   s       úP/var/www/piapp/venv/lib/python3.11/site-packages/authlib/oauth2/rfc7523/token.pyÚ__init__z JWTBearerTokenGenerator.__init__   s   € Ø$ˆŒØˆŒØˆŒˆˆó    c                 ó4   — |r|                       |¦  «        }|S r	   )Úget_allowed_scope)ÚclientÚscopes     r   r   z)JWTBearerTokenGenerator.get_allowed_scope"   s"   € àð 	4Ø×,Ò,¨UÑ3Ô3ˆEØˆr   c                 ó*   — |                       ¦   «         S )z¯Return user's ID as ``sub`` value in token payload. For instance::

            @staticmethod
            def get_sub_value(user):
                return str(user.id)
        )Úget_user_id)Úusers    r   Úget_sub_valuez%JWTBearerTokenGenerator.get_sub_value(   s   € ð ×ÒÑ!Ô!Ð!r   c                 ó  — |                       ||¦  «        }t          t          j        ¦   «         ¦  «        }|||||z   |                     ¦   «         dœ}| j        r
| j        |d<   |r|                      |¦  «        |d<   |S )N)r   Ú
grant_typeÚiatÚexpÚ	client_idÚissÚsub)r   ÚintÚtimeÚget_client_idr   r   )r   r   r   Ú
expires_inr   r   Ú	issued_atÚdatas           r   Úget_token_dataz&JWTBearerTokenGenerator.get_token_data2   s‘   € Ø×&Ò& v¨uÑ5Ô5ˆÝœ	™œÑ$Ô$ˆ	àØ$ØØ˜zÑ)Ø×-Ò-Ñ/Ô/ð
ð 
ˆð Œ;ð 	&Øœ+ˆD‰KØð 	3Ø×,Ò,¨TÑ2Ô2ˆD‰KØˆr   c                 óÆ   — |s| j         }|                      |||||¦  «        }t          j        d| j        i|| j        d¬¦  «        }dt          |¦  «        |dœ}|r||d<   |S )a€  Generate a bearer token for OAuth 2.0 authorization token endpoint.

        :param client: the client that making the request.
        :param grant_type: current requested grant_type.
        :param user: current authorized user.
        :param expires_in: if provided, use this value as expires_in.
        :param scope: current requested scope.
        :return: Token dict
        r   F)ÚkeyÚcheckÚBearer)Ú
token_typeÚaccess_tokenr#   r   )ÚDEFAULT_EXPIRES_INr&   r   Úencoder   r
   r   )	r   r   r   r   r   r#   Ú
token_datar,   Útokens	            r   Úgeneratez JWTBearerTokenGenerator.generateB   s†   € ð ð 	1ØÔ0ˆJà×(Ò(¨°V¸ZÈÈuÑUÔUˆ
Ý”z 5¨$¬(Ð"3°ZÀTÄ_Ð\aÐbÑbÔbˆà"Ý% lÑ3Ô3Ø$ð
ð 
ˆð
 ð 	#Ø"ˆE'‰NØˆr   Tc                 ó4   — |                       |||||¦  «        S r	   )r1   )r   r   r   r   r   r#   Úinclude_refresh_tokens          r   Ú__call__z JWTBearerTokenGenerator.__call__Z   s   € ð }Š}˜Z¨°°u¸jÑIÔIÐIr   )Nr   )NN)NNN)NNNT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   r   Ústaticmethodr   r   r&   r1   r4   © r   r   r   r      s»   € € € € € ðð ð( Ððð ð ð ð
 ðð ñ „\ðð
 ð"ð "ñ „\ð"ðð ð ð ð ð ð ð ð0 =AØ8<ðJð Jð Jð Jð Jð Jr   r   )r!   Úauthlib.common.encodingr   Úauthlib.joser   r   r:   r   r   ú<module>r=      sx   ðØ €€€Ø -Ð -Ð -Ð -Ð -Ð -Ø Ð Ð Ð Ð Ð ðWJð WJð WJð WJð WJñ WJô WJð WJð WJð WJr   