D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.6
/
site-packages
/
oauthlib
/
oauth2
/
rfc6749
/
clients
/
__pycache__
/
Filename :
base.cpython-36.pyc
back
Copy
3 ,�[aQ � @ s� d Z ddlmZmZ ddlZddlZddlmZ ddlm Z ddl mZmZ ddl mZmZmZ ddlmZ d Zd ZdZdd iZG dd� de�ZdS )z� oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming OAuth 2.0 RFC6749. � )�absolute_import�unicode_literalsN)�generate_token)�tokens)�InsecureTransportError�TokenExpiredError)�parse_token_response�prepare_token_request� prepare_token_revocation_request)�is_secure_transportZauth_headerZquery�bodyzContent-Typez!application/x-www-form-urlencodedc @ s� e Zd ZdZedddddddddefdd�Zedd� �Zdd � Z d d� Z dd � Zd)dd�Zd*dd�Z d+dd�Zd,dd�Zd-dd�Zd.dd�Zd/dd�Zd0dd �Zdddedfd!d"�Zd#d$� Zd%d&� Zd'd(� ZdS )1�Clienta� Base OAuth2 client responsible for access token management. This class also acts as a generic interface providing methods common to all client types such as ``prepare_authorization_request`` and ``prepare_token_revocation_request``. The ``prepare_x_request`` methods are the recommended way of interacting with clients (as opposed to the abstract prepare uri/body/etc methods). They are recommended over the older set because they are easier to use (more consistent) and add a few additional security checks, such as HTTPS and state checking. Some of these methods require further implementation only provided by the specific purpose clients such as :py:class:`oauthlib.oauth2.MobileApplicationClient` and thus you should always seek to use the client class matching the OAuth workflow you need. For Python, this is usually :py:class:`oauthlib.oauth2.WebApplicationClient`. �BearerNc K sn || _ || _|| _|| _|| _|| _|| _|p0i | _| | _|| _ | | _ || _d| _d| _ d| _| j| j� dS )as Initialize a client with commonly used attributes. :param client_id: Client identifier given by the OAuth provider upon registration. :param default_token_placement: Tokens can be supplied in the Authorization header (default), the URL query component (``query``) or the request body (``body``). :param token_type: OAuth 2 token type. Defaults to Bearer. Change this if you specify the ``access_token`` parameter and know it is of a different token type, such as a MAC, JWT or SAML token. Can also be supplied as ``token_type`` inside the ``token`` dict parameter. :param access_token: An access token (string) used to authenticate requests to protected resources. Can also be supplied inside the ``token`` dict parameter. :param refresh_token: A refresh token (string) used to refresh expired tokens. Can also be supplied inside the ``token`` dict parameter. :param mac_key: Encryption key used with MAC tokens. :param mac_algorithm: Hashing algorithm for MAC tokens. :param token: A dict of token attributes such as ``access_token``, ``token_type`` and ``expires_at``. :param scope: A list of default scopes to request authorization for. :param state: A CSRF protection string used during authorization. :param redirect_url: The redirection endpoint on the client side to which the user returns after authorization. :param state_generator: A no argument state generation callable. Defaults to :py:meth:`oauthlib.common.generate_token`. N)� client_id�default_token_placement� token_type�access_token� refresh_token�mac_key� mac_algorithm�token�scope�state_generator�state�redirect_url�code� expires_in�_expires_at�populate_token_attributes)�selfr r r r r r r r r r r r �kwargs� r! �/usr/lib/python3.6/base.py�__init__3 s 4 zClient.__init__c C s | j | jd�S )aO Supported token types and their respective methods Additional tokens can be supported by extending this dictionary. The Bearer token spec is stable and safe to use. The MAC token spec is not yet stable and support for MAC tokens is experimental and currently matching version 00 of the spec. )r ZMAC)�_add_bearer_token�_add_mac_token)r r! r! r"