Ë
    ”Âi8  ã                   ó8   — d dl Z d dlmZ d dlmZ  G d„ d«      Zy)é    N)Ú	to_native)Újwtc                   ó\   — 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y)Ú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  Nc                 ó.   — || _         || _        || _        y ©N)Ú
secret_keyÚissuerÚalg)Úselfr	   r
   r   s       úT/var/www/timesheet/venv/lib/python3.12/site-packages/authlib/oauth2/rfc7523/token.pyÚ__init__z JWTBearerTokenGenerator.__init__   s   € Ø$ˆŒØˆŒØˆ�ó    c                 ó,   — |r| j                  |«      }|S r   )Úget_allowed_scope)ÚclientÚscopes     r   r   z)JWTBearerTokenGenerator.get_allowed_scope$   s   € áØ×,Ñ,¨UÓ3ˆEØˆr   c                 ó"   — | j                  «       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                 óø   — | j                  ||«      }t        t        j                  «       «      }|||||z   |j                  «       dœ}| j                  r| j                  |d<   |r| j                  |«      |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_data4   sz   € Ø×&Ñ& v¨uÓ5ˆÜœŸ	™	›Ó$ˆ	àØ$ØØ˜zÑ)Ø×-Ñ-Ó/ñ
ˆð �;Š;ØŸ+™+ˆD�‰KÙØ×,Ñ,¨TÓ2ˆD�‰KØˆr   c                 óÖ   — |€| j                   }| 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.generateD   s{   € ð ÐØ×0Ñ0ˆJà×(Ñ(¨°V¸ZÈÈuÓUˆ
Ü—z‘zØ�D—H‘HÐ˜z¨t¯©Àeô
ˆð #Ü% lÓ3Ø$ñ
ˆñ
 Ø"ˆE�'‰NØˆr   c                 ó,   — | j                  |||||«      S r   )r0   )r   r   r   r   r   r"   Úinclude_refresh_tokens          r   Ú__call__z JWTBearerTokenGenerator.__call__^   s   € ð �}‰}˜Z¨°°u¸jÓIÐIr   )NÚRS256)NN)NNN)NNNT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r,   r   Ústaticmethodr   r   r%   r0   r3   © r   r   r   r      sZ   „ ñð* Ðóð
 ñó ðð
 ñ"ó ð"óó ð< ØØØ"ô
Jr   r   )r    Úauthlib.common.encodingr   Úauthlib.joser   r   r:   r   r   ú<module>r=      s   ðÛ å -Ý ÷aJò aJr   