
    k7iJ                        S r SSKJr  SSKJr  / SQr " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      rg%)&a  authlib.oauth2.rfc6749.errors.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Implementation for OAuth 2 Error Response. A basic error has
parameters:

Error:
REQUIRED.  A single ASCII [USASCII] error code.

error_description
OPTIONAL.  Human-readable ASCII [USASCII] text providing
additional information, used to assist the client developer in
understanding the error that occurred.

error_uri
OPTIONAL.  A URI identifying a human-readable web page with
information about the error, used to provide the client
developer with additional information about the error.
Values for the "error_uri" parameter MUST conform to the
URI-reference syntax and thus MUST NOT include characters
outside the set %x21 / %x23-5B / %x5D-7E.

state
REQUIRED if a "state" parameter was present in the client
authorization request.  The exact value received from the
client.

https://tools.ietf.org/html/rfc6749#section-5.2

:copyright: (c) 2017 by Hsiaoming Yang.

    is_secure_transport)OAuth2Error)r   InsecureTransportErrorInvalidRequestErrorInvalidClientErrorUnauthorizedClientErrorInvalidGrantErrorUnsupportedResponseTypeErrorUnsupportedGrantTypeErrorInvalidScopeErrorAccessDeniedErrorMissingAuthorizationErrorUnsupportedTokenTypeErrorMissingCodeExceptionMissingTokenExceptionMissingTokenTypeExceptionMismatchingStateExceptionc                   ,    \ rS rSrSrSr\S 5       rSrg)r   9   insecure_transportzOAuth 2 MUST utilize https.c                 2    [        U5      (       d  U " 5       eg)z:Check and raise InsecureTransportError with the given URI.Nr   )clsuris     W/home/james-whalen/.local/lib/python3.13/site-packages/authlib/oauth2/rfc6749/errors.pycheckInsecureTransportError.check=   s     #3''%K (     N)	__name__
__module____qualname____firstlineno__errordescriptionclassmethodr   __static_attributes__r   r   r   r   r   9   s     E/K r   r   c                       \ rS rSrSrSrSrg)r   D   a.  The request is missing a required parameter, includes an
unsupported parameter value (other than grant type),
repeats a parameter, includes multiple credentials,
utilizes more than one mechanism for authenticating the
client, or is otherwise malformed.

https://tools.ietf.org/html/rfc6749#section-5.2
invalid_requestr   Nr    r!   r"   r#   __doc__r$   r'   r   r   r   r   r   D   s     Er   r   c                   4   ^  \ rS rSrSrSrSrU 4S jrSrU =r	$ )r   Q   aQ  Client authentication failed (e.g., unknown client, no
client authentication included, or unsupported
authentication method).  The authorization server MAY
return an HTTP 401 (Unauthorized) status code to indicate
which HTTP authentication schemes are supported.  If the
client attempted to authenticate via the "Authorization"
request header field, the authorization server MUST
respond with an HTTP 401 (Unauthorized) status code and
include the "WWW-Authenticate" response header field
matching the authentication scheme used by the client.

https://tools.ietf.org/html/rfc6749#section-5.2
invalid_clienti  c                    > [         TU ]  5       nU R                  S:X  a]  U R                  5       nUR	                  SS5      nSU R
                   S3SU S3/nUR                  SSSR                  U5      -   45        U$ )	N  "|error="error_description="WWW-AuthenticatezBasic , )superget_headersstatus_codeget_error_descriptionreplacer$   appendjoin)selfheaderserror_descriptionextras	__class__s       r   r9   InvalidClientError.get_headersc   s    '%'s" $ : : < 1 9 9#s C$**Q'%&7%8:F NN.499V;L0LMNr   r   )
r    r!   r"   r#   r,   r$   r:   r9   r'   __classcell__rC   s   @r   r   r   Q   s     EK r   r   c                       \ rS rSrSrSrSrg)r
   q   a  The provided authorization grant (e.g., authorization
code, resource owner credentials) or refresh token is
invalid, expired, revoked, does not match the redirection
URI used in the authorization request, or was issued to
another client.

https://tools.ietf.org/html/rfc6749#section-5.2
invalid_grantr   Nr+   r   r   r   r
   r
   q   s     Er   r
   c                       \ rS rSrSrSrSrg)r	   ~   zThe authenticated client is not authorized to use this
authorization grant type.

https://tools.ietf.org/html/rfc6749#section-5.2
unauthorized_clientr   Nr+   r   r   r   r	   r	   ~   s     "Er   r	   c                   6   ^  \ rS rSrSrSrU 4S jrS rSrU =r	$ )r      zWThe authorization server does not support obtaining
an access token using this method.
unsupported_response_typec                 2   > [         TU ]  " U0 UD6  Xl        g N)r8   __init__response_type)r?   rS   argskwargsrC   s       r   rR   %UnsupportedResponseTypeError.__init__   s    $)&)*r   c                 "    SU R                    S3$ )Nzresponse_type= is not supportedrS   r?   s    r   r;   2UnsupportedResponseTypeError.get_error_description   s     2 233DEEr   rY   
r    r!   r"   r#   r,   r$   rR   r;   r'   rE   rF   s   @r   r   r      s      (E+F Fr   r   c                   6   ^  \ rS rSrSrSrU 4S jrS rSrU =r	$ )r      z|The authorization grant type is not supported by the
authorization server.

https://tools.ietf.org/html/rfc6749#section-5.2
unsupported_grant_typec                 .   > [         TU ]  5         Xl        g rQ   )r8   rR   
grant_type)r?   ra   rC   s     r   rR   "UnsupportedGrantTypeError.__init__   s    $r   c                 "    SU R                    S3$ )Nzgrant_type=rX   ra   rZ   s    r   r;   /UnsupportedGrantTypeError.get_error_description   s    T__-->??r   rd   r\   rF   s   @r   r   r      s      %E%@ @r   r   c                        \ rS rSrSrSrSrSrg)r      zThe requested scope is invalid, unknown, malformed, or
exceeds the scope granted by the resource owner.

https://tools.ietf.org/html/rfc6749#section-5.2
invalid_scopez6The requested scope is invalid, unknown, or malformed.r   Nr    r!   r"   r#   r,   r$   r%   r'   r   r   r   r   r      s     EJKr   r   c                        \ rS rSrSrSrSrSrg)r      zThe resource owner or authorization server denied the request.

Used in authorization endpoint for "code" and "implicit". Defined in
`Section 4.1.2.1`_.

.. _`Section 4.1.2.1`: https://tools.ietf.org/html/rfc6749#section-4.1.2.1
access_deniedz=The resource owner or authorization server denied the requestr   Nri   r   r   r   r   r      s     EQKr   r   c                   <   ^  \ rS rSrSrSU 4S jjrU 4S jrSrU =r$ )ForbiddenError   r1   c                 :   > [         TU ]  5         Xl        X l        g rQ   )r8   rR   	auth_typerealm)r?   rq   rr   rC   s      r   rR   ForbiddenError.__init__   s    "
r   c                   > [         TU ]  5       nU R                  (       d  U$ / nU R                  (       a  UR	                  SU R                   S35        UR	                  SU R
                   S35        U R                  nUR	                  SU S35        UR	                  SU R                   S3SR                  U5      -   45        U$ )Nzrealm="r2   r4   r5   r6    r7   )r8   r9   rq   rr   r=   r$   r%   r>   )r?   r@   rB   rA   rC   s       r   r9   ForbiddenError.get_headers   s    '%'~~N::MMGDJJ<q12

|1-. ,,+,=+>a@A*t~~.>a,@499VCT,TUVr   )rq   rr   )NN)	r    r!   r"   r#   r:   rR   r9   r'   rE   rF   s   @r   rn   rn      s    K
 r   rn   c                       \ rS rSrSrSrSrg)r      missing_authorizationz#Missing 'Authorization' in headers.r   Nr    r!   r"   r#   r$   r%   r'   r   r   r   r   r      s    #E7Kr   r   c                       \ rS rSrSrSrg)r      unsupported_token_typer   N)r    r!   r"   r#   r$   r'   r   r   r   r   r      s    $Er   r   c                       \ rS rSrSrSrSrg)r      missing_codezMissing 'code' in response.r   Nrz   r   r   r   r   r      s    E/Kr   r   c                       \ rS rSrSrSrSrg)r      missing_tokenz#Missing 'access_token' in response.r   Nrz   r   r   r   r   r      s    E7Kr   r   c                       \ rS rSrSrSrSrg)r      missing_token_typez!Missing 'token_type' in response.r   Nrz   r   r   r   r   r      s     E5Kr   r   c                       \ rS rSrSrSrSrg)r      mismatching_statez6CSRF Warning! State not equal in request and response.r   Nrz   r   r   r   r   r      s    EJKr   r   N)r,   authlib.common.securityr   authlib.oauth2.baser   __all__r   r   r   r
   r	   r   r   r   r   rn   r   r   r   r   r   r   r   r   r   <module>r      s   B 8 +([ 
+ 
 @
 
"k "F; F@ @"K K
R 
R [ .8 8
% %0; 0
8K 8
6 6
K Kr   