Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/__pycache__/errors.cpython-36.pyc

3

 ��c�2�@sJdZddlZddlmZmZGdd�de�ZGdd�de�ZGdd	�d	e�ZGd
d�de�Z	Gdd
�d
e�Z
Gdd�de�ZGdd�de�ZGdd�de�Z
Gdd�de
�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�ZGd*d+�d+e�ZGd,d-�d-e�ZGd.d/�d/e�ZGd0d1�d1e�ZGd2d3�d3e�ZGd4d5�d5e
�ZGd6d7�d7e�ZGd8d9�d9e�Z Gd:d;�d;e�Z!Gd<d=�d=e�Z"Gd>d?�d?e�Z#Gd@dA�dAe�Z$GdBdC�dCe�Z%GdDdE�dEe�Z&GdFdG�dGe�Z'dJdHdI�Z(dS)Kz�
oauthlib.oauth2.rfc6749.errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error used both by OAuth 2 clients and providers to represent the spec
defined error responses for all four core grant types.
�N)�add_params_to_uri�	urlencodecsbeZdZdZdZdZd�fdd�	Zdd�Zedd	��Z	ed
d��Z
edd
��Zedd��Z�Z
S)�OAuth2ErrorNi��cs�|dk	r||_dj|j|j�}|r2|dt|�7}t�j|�||_||_|rT||_|r�|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_|s�|j|_n$d|_	d|_
d|_d|_d|_
d|_dS)a0
        :param description: A human-readable ASCII [USASCII] text providing
                            additional information, used to assist the client
                            developer in understanding the error that occurred.
                            Values for the "error_description" parameter
                            MUST NOT include characters outside the set
                            x20-21 / x23-5B / x5D-7E.

        :param uri: 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.

        :param state: A CSRF protection value received from the client.

        :param status_code:

        :param request: OAuthlib request.
        :type request: oauthlib.common.Request
        Nz({}) {}� )�description�format�error�repr�super�__init__�uri�state�status_codeZredirect_uriZ	client_idZscopesZ
response_type�
response_modeZ
grant_type)�selfrr
rr�request�message)�	__class__��B/tmp/pip-build-_uu8ur7s/oauthlib/oauthlib/oauth2/rfc6749/errors.pyrs2
zOAuth2Error.__init__cCs|jdk}t||j|�S)N�fragment)rr�	twotuples)rr
rrrr�in_uriIs
zOAuth2Error.in_uricCsRd|jfg}|jr"|jd|jf�|jr8|jd|jf�|jrN|jd|jf�|S)Nr	�error_description�	error_urir)r	r�appendr
r)rr	rrrrMszOAuth2Error.twotuplescCs
t|j�S)N)rr)rrrr�
urlencodedXszOAuth2Error.urlencodedcCstjt|j��S)N)�json�dumps�dictr)rrrrr\szOAuth2Error.jsoncCs^|jdkrZdj|j�g}|jr0|jdj|j��|jrH|jdj|j��dddj|�iSiS)Ni�z
error="{}"zerror_description="{}"zerror_uri="{}"zWWW-AuthenticatezBearer z, )rrr	rrr
�join)rZ
authvaluesrrr�headers`s
zOAuth2Error.headers)NNNNN)�__name__�
__module__�__qualname__r	rrrr�propertyrrrr"�
__classcell__rr)rrr
s6rc@seZdZdZdS)�TokenExpiredErrorZ
token_expiredN)r#r$r%r	rrrrr(ssr(c@seZdZdZdZdS)�InsecureTransportErrorZinsecure_transportzOAuth 2 MUST utilize https.N)r#r$r%r	rrrrrr)wsr)c@seZdZdZdZdS)�MismatchingStateErrorZmismatching_statez6CSRF Warning! State not equal in request and response.N)r#r$r%r	rrrrrr*|sr*c@seZdZdZdS)�MissingCodeErrorZmissing_codeN)r#r$r%r	rrrrr+�sr+c@seZdZdZdS)�MissingTokenErrorZ
missing_tokenN)r#r$r%r	rrrrr,�sr,c@seZdZdZdS)�MissingTokenTypeErrorZmissing_token_typeN)r#r$r%r	rrrrr-�sr-c@seZdZdZdS)�FatalClientErrora�
    Errors during authorization where user should not be redirected back.

    If the request fails due to a missing, invalid, or mismatching
    redirection URI, or if the client identifier is missing or invalid,
    the authorization server SHOULD inform the resource owner of the
    error and MUST NOT automatically redirect the user-agent to the
    invalid redirection URI.

    Instead the user should be informed of the error by the provider itself.
    N)r#r$r%�__doc__rrrrr.�sr.c@seZdZdZdZdS)�InvalidRequestFatalErrorz�
    For fatal errors, the request is missing a required parameter, includes
    an invalid parameter value, includes a parameter more than once, or is
    otherwise malformed.
    �invalid_requestN)r#r$r%r/r	rrrrr0�sr0c@seZdZdZdS)�InvalidRedirectURIErrorzInvalid redirect URI.N)r#r$r%rrrrrr2�sr2c@seZdZdZdS)�MissingRedirectURIErrorzMissing redirect URI.N)r#r$r%rrrrrr3�sr3c@seZdZdZdS)�MismatchingRedirectURIErrorzMismatching redirect URI.N)r#r$r%rrrrrr4�sr4c@seZdZdZdS)�InvalidClientIdErrorz"Invalid client_id parameter value.N)r#r$r%rrrrrr5�sr5c@seZdZdZdS)�MissingClientIdErrorzMissing client_id parameter.N)r#r$r%rrrrrr6�sr6c@seZdZdZdZdS)�InvalidRequestErrorz�
    The request is missing a required parameter, includes an invalid
    parameter value, includes a parameter more than once, or is
    otherwise malformed.
    r1N)r#r$r%r/r	rrrrr7�sr7c@seZdZdZdS)�MissingResponseTypeErrorz Missing response_type parameter.N)r#r$r%rrrrrr8�sr8c@seZdZdZdZdS)�MissingCodeChallengeErrora�
    If the server requires Proof Key for Code Exchange (PKCE) by OAuth
    public clients and the client does not send the "code_challenge" in
    the request, the authorization endpoint MUST return the authorization
    error response with the "error" value set to "invalid_request".  The
    "error_description" or the response of "error_uri" SHOULD explain the
    nature of error, e.g., code challenge required.
    zCode challenge required.N)r#r$r%r/rrrrrr9�sr9c@seZdZdZdZdS)�MissingCodeVerifierErrorzr
    The request to the token endpoint, when PKCE is enabled, has
    the parameter `code_verifier` REQUIRED.
    zCode verifier required.N)r#r$r%r/rrrrrr:�sr:c@seZdZdZdZdS)�AccessDeniedErrorzH
    The resource owner or authorization server denied the request.
    Z
access_deniedN)r#r$r%r/r	rrrrr;�sr;c@seZdZdZdZdS)�UnsupportedResponseTypeErrorzj
    The authorization server does not support obtaining an authorization
    code using this method.
    Zunsupported_response_typeN)r#r$r%r/r	rrrrr<�sr<c@seZdZdZdZdS)�#UnsupportedCodeChallengeMethodErrorad
    If the server supporting PKCE does not support the requested
    transformation, the authorization endpoint MUST return the
    authorization error response with "error" value set to
    "invalid_request".  The "error_description" or the response of
    "error_uri" SHOULD explain the nature of error, e.g., transform
    algorithm not supported.
    z"Transform algorithm not supported.N)r#r$r%r/rrrrrr=�sr=c@seZdZdZdZdS)�InvalidScopeErrorz�
    The requested scope is invalid, unknown, or malformed, or
    exceeds the scope granted by the resource owner.

    https://tools.ietf.org/html/rfc6749#section-5.2
    Z
invalid_scopeN)r#r$r%r/r	rrrrr>�sr>c@seZdZdZdZdS)�ServerErrora	
    The authorization server encountered an unexpected condition that
    prevented it from fulfilling the request.  (This error code is needed
    because a 500 Internal Server Error HTTP status code cannot be returned
    to the client via a HTTP redirect.)
    �server_errorN)r#r$r%r/r	rrrrr?�sr?c@seZdZdZdZdS)�TemporarilyUnavailableErrora
    The authorization server is currently unable to handle the request
    due to a temporary overloading or maintenance of the server.
    (This error code is needed because a 503 Service Unavailable HTTP
    status code cannot be returned to the client via a HTTP redirect.)
    Ztemporarily_unavailableN)r#r$r%r/r	rrrrrA	srAc@seZdZdZdZdZdS)�InvalidClientErroraG
    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.
    Zinvalid_clienti�N)r#r$r%r/r	rrrrrrBsrBc@seZdZdZdZdZdS)�InvalidGrantErrora7
    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
    Z
invalid_granti�N)r#r$r%r/r	rrrrrrC#srCc@seZdZdZdZdS)�UnauthorizedClientErrorz^
    The authenticated client is not authorized to use this authorization
    grant type.
    Zunauthorized_clientN)r#r$r%r/r	rrrrrD0srDc@seZdZdZdZdS)�UnsupportedGrantTypeErrorzX
    The authorization grant type is not supported by the authorization
    server.
    Zunsupported_grant_typeN)r#r$r%r/r	rrrrrE8srEc@seZdZdZdZdS)�UnsupportedTokenTypeErrorz�
    The authorization server does not support the hint of the
    presented token type.  I.e. the client tried to revoke an access token
    on a server not supporting this feature.
    Zunsupported_token_typeN)r#r$r%r/r	rrrrrF@srFc@seZdZdZdZdZdZdS)�InvalidTokenErrora
    The access token provided is expired, revoked, malformed, or
    invalid for other reasons.  The resource SHOULD respond with
    the HTTP 401 (Unauthorized) status code.  The client MAY
    request a new access token and retry the protected resource
    request.
    Z
invalid_tokeni�zWThe access token provided is expired, revoked, malformed, or invalid for other reasons.N)r#r$r%r/r	rrrrrrrGIsrGc@seZdZdZdZdZdZdS)�InsufficientScopeErrora
    The request requires higher privileges than provided by the
    access token.  The resource server SHOULD respond with the HTTP
    403 (Forbidden) status code and MAY include the "scope"
    attribute with the scope necessary to access the protected
    resource.
    Zinsufficient_scopei�zIThe request requires higher privileges than provided by the access token.N)r#r$r%r/r	rrrrrrrHWsrHc@seZdZdZdZdS)�ConsentRequireda
    The Authorization Server requires End-User consent.

    This error MAY be returned when the prompt parameter value in the
    Authentication Request is none, but the Authentication Request cannot be
    completed without displaying a user interface for End-User consent.
    Zconsent_requiredN)r#r$r%r/r	rrrrrIesrIc@seZdZdZdZdS)�
LoginRequireda'
    The Authorization Server requires End-User authentication.

    This error MAY be returned when the prompt parameter value in the
    Authentication Request is none, but the Authentication Request cannot be
    completed without displaying a user interface for End-User authentication.
    Zlogin_requiredN)r#r$r%r/r	rrrrrJpsrJcs eZdZdZ�fdd�Z�ZS)�CustomOAuth2Errorz�
    This error is a placeholder for all custom errors not described by the RFC.
    Some of the popular OAuth2 providers are using custom errors.
    cs||_t�j||�dS)N)r	rr)rr	�args�kwargs)rrrr�szCustomOAuth2Error.__init__)r#r$r%r/rr'rr)rrrK{srKcCszddl}ddl}|jd�|jd�|jd�d�}x4|j|jt|j�D]\}}|j|krD|f|��qDWtfd|i|���dS)Nrrrr)rr
rr	)	�inspect�sys�get�
getmembers�modulesr#Zisclassr	rK)r	�paramsrNrOrM�_�clsrrr�raise_from_error�s
rV)N))r/rZoauthlib.commonrr�	Exceptionrr(r)r*r+r,r-r.r0r2r3r4r5r6r7r8r9r:r;r<r=r>r?rArBrCrDrErFrGrHrIrJrKrVrrrr�<module>sJf		



	

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists