
    ~hZ
                     V    d dl mZ d dlmZ d dlmZ ddlmZ ddlm	Z	  G d de	      Z
y	)
    )ContinueIteration)InvalidTokenError)JWTBearerTokenValidator   )UnsupportedTokenTypeError)RevocationEndpointc                   0     e Zd ZdZd fd	Zd Zd Z xZS )JWTRevocationEndpointaw  JWTRevocationEndpoint inherits from `RFC7009`_
    :class:`~authlib.oauth2.rfc7009.RevocationEndpoint`.

    The JWT access tokens cannot be revoked.
    If the submitted token is a JWT access token, then revocation returns
    a `invalid_token_error`.

    :param issuer: The issuer identifier.

    :param \\*\\*kwargs: Other parameters are inherited from
        :class:`~authlib.oauth2.rfc7009.RevocationEndpoint`.

    Plain text access tokens and other kind of tokens such as refresh_tokens
    will be ignored by this endpoint and passed to the next revocation endpoint::

        class MyJWTAccessTokenRevocationEndpoint(JWTRevocationEndpoint):
            def get_jwks(self): ...


        # endpoint dedicated to JWT access token revokation
        authorization_server.register_endpoint(
            MyJWTAccessTokenRevocationEndpoint(
                issuer="https://authorization-server.example.org",
            )
        )

        # another endpoint dedicated to refresh token revokation
        authorization_server.register_endpoint(MyRefreshTokenRevocationEndpoint)

    .. _RFC7009: https://tools.ietf.org/html/rfc7009
    c                 6    t        |   |d|i| || _        y )Nserver)super__init__issuer)selfr   r   argskwargs	__class__s        ]/opt/mcp/mcp-sentiment/venv/lib/python3.12/site-packages/authlib/oauth2/rfc9068/revocation.pyr   zJWTRevocationEndpoint.__init__*   s!    $8v88    c                 N   | j                  ||       |j                  j                  d      dvr
t               t	        | j
                  d      }| j                  |_        	 |j                  |j                  d          t               # t        $ r}t               |d}~ww xY w) token_type_hint)access_tokenNN)r   resource_servertoken)
check_paramsformgetr   r   r   get_jwksauthenticate_tokenr   r   )r   requestclient	validatorexcs        r   r    z(JWTRevocationEndpoint.authenticate_token.   s    '6* <<-.6LL#%%+4;;PTU	!]]		/((g)>? ())	 ! 	/#%3.	/s   #B 	B$BB$c                     t               )zReturn the JWKs that will be used to check the JWT access token signature.
        Developers MUST re-implement this method::

            def get_jwks(self):
                return load_jwks("jwks.json")
        )NotImplementedError)r   s    r   r   zJWTRevocationEndpoint.get_jwksC   s     "##r   )N)__name__
__module____qualname____doc__r   r    r   __classcell__)r   s   @r   r
   r
   	   s    @**$r   r
   N)authlib.common.errorsr   authlib.oauth2.rfc6750.errorsr   &authlib.oauth2.rfc9068.token_validatorr   rfc6749r   rfc7009r   r
    r   r   <module>r2      s#    3 ; J / (A$. A$r   