ó
O'—^c           @@ sR  d  Z  d d l m Z m Z 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
 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 d e e e e f d „  ƒ  YZ d e e e e f d „  ƒ  YZ d e e e f d „  ƒ  YZ d e e e f d „  ƒ  YZ d e e e f d „  ƒ  YZ d S(   uš   
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
i    (   t   absolute_importt   unicode_literalsi   (   t   BearerToken(   t   AuthorizationCodeGrant(   t   ImplicitGrant(   t%   ResourceOwnerPasswordCredentialsGrant(   t   ClientCredentialsGrant(   t   RefreshTokenGranti   (   t   AuthorizationEndpoint(   t   TokenEndpoint(   t   ResourceEndpoint(   t   RevocationEndpointt   Serverc           B@ s    e  Z d  Z d d d d „ Z RS(   u<   An all-in-one endpoint featuring all four major grant types.c         O@ sí   t  | ƒ } t | ƒ } t | ƒ }	 t | ƒ }
 t | ƒ } t | | | | ƒ } t j |  d d d i | d 6| d 6d | ƒt j |  d d d i | d 6|	 d	 6|
 d
 6| d 6d | ƒt	 j |  d d d i | d 6ƒt
 j |  | ƒ d S(   uø  Construct a new all-grants-in-one server.

        :param request_validator: An implementation of
                                  oauthlib.oauth2.RequestValidator.
        :param token_expires_in: An int or a function to generate a token
                                 expiration offset (in seconds) given a
                                 oauthlib.common.Request object.
        :param token_generator: A function to generate a token from a request.
        :param refresh_token_generator: A function to generate a token from a
                                        request for the refresh token.
        :param kwargs: Extra parameters to pass to authorization-,
                       token-, resource-, and revocation-endpoint constructors.
        t   default_response_typeu   codet   response_typesu   tokent   default_token_typet   default_grant_typeu   authorization_codet   grant_typesu   passwordu   client_credentialsu   refresh_tokent   default_tokenu   Bearert   token_typesN(   R   R   R   R   R   R   R   t   __init__R	   R
   R   (   t   selft   request_validatort   token_expires_int   token_generatort   refresh_token_generatort   argst   kwargst
   auth_grantt   implicit_grantt   password_grantt   credentials_grantt   refresh_grantt   bearer(    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR      s.    		

N(   t   __name__t
   __module__t   __doc__t   NoneR   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR      s   t   WebApplicationServerc           B@ s    e  Z d  Z d d d d „ Z RS(   uL   An all-in-one endpoint featuring Authorization code grant and Bearer tokens.c   	      K@ s´   t  | ƒ } t | ƒ } t | | | | ƒ } t j |  d d d i | d 6d | ƒt j |  d d d i | d 6| d 6d | ƒt j |  d	 d
 d i | d
 6ƒt j |  | ƒ d S(   uö  Construct a new web application server.

        :param request_validator: An implementation of
                                  oauthlib.oauth2.RequestValidator.
        :param token_expires_in: An int or a function to generate a token
                                 expiration offset (in seconds) given a
                                 oauthlib.common.Request object.
        :param token_generator: A function to generate a token from a request.
        :param refresh_token_generator: A function to generate a token from a
                                        request for the refresh token.
        :param kwargs: Extra parameters to pass to authorization-,
                       token-, resource-, and revocation-endpoint constructors.
        R   u   codeR   R   R   u   authorization_codeR   u   refresh_tokenR   u   BearerR   N(   R   R   R   R   R   R	   R
   R   (	   R   R   R   R   R   R   R   R    R!   (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR   M   s    	
N(   R"   R#   R$   R%   R   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR&   H   s   t   MobileApplicationServerc           B@ s    e  Z d  Z d d d d „ Z RS(   uG   An all-in-one endpoint featuring Implicit code grant and Bearer tokens.c         K@ s„   t  | ƒ } t | | | | ƒ } t j |  d d d i | d 6d | ƒt j |  d d d i | d 6ƒt j |  | d d	 g ƒd
 S(   uõ  Construct a new implicit grant server.

        :param request_validator: An implementation of
                                  oauthlib.oauth2.RequestValidator.
        :param token_expires_in: An int or a function to generate a token
                                 expiration offset (in seconds) given a
                                 oauthlib.common.Request object.
        :param token_generator: A function to generate a token from a request.
        :param refresh_token_generator: A function to generate a token from a
                                        request for the refresh token.
        :param kwargs: Extra parameters to pass to authorization-,
                       token-, resource-, and revocation-endpoint constructors.
        R   u   tokenR   R   R   u   BearerR   t   supported_token_typesu   access_tokenN(   R   R   R   R   R
   R   (   R   R   R   R   R   R   R   R!   (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR   s   s    	
N(   R"   R#   R$   R%   R   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR'   n   s   t   LegacyApplicationServerc           B@ s    e  Z d  Z d d d d „ Z RS(   u]   An all-in-one endpoint featuring Resource Owner Password Credentials grant and Bearer tokens.c   	      K@ sŽ   t  | ƒ } t | ƒ } t | | | | ƒ } t j |  d d d i | d 6| d 6d | ƒt j |  d d d i | d 6ƒt j |  | ƒ d	 S(
   u  Construct a resource owner password credentials grant server.

        :param request_validator: An implementation of
                                  oauthlib.oauth2.RequestValidator.
        :param token_expires_in: An int or a function to generate a token
                                 expiration offset (in seconds) given a
                                 oauthlib.common.Request object.
        :param token_generator: A function to generate a token from a request.
        :param refresh_token_generator: A function to generate a token from a
                                        request for the refresh token.
        :param kwargs: Extra parameters to pass to authorization-,
                       token-, resource-, and revocation-endpoint constructors.
        R   u   passwordR   u   refresh_tokenR   R   u   BearerR   N(   R   R   R   R	   R   R
   R   (	   R   R   R   R   R   R   R   R    R!   (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR   ”   s    		
N(   R"   R#   R$   R%   R   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR)      s   t   BackendApplicationServerc           B@ s    e  Z d  Z d d d d „ Z RS(   uL   An all-in-one endpoint featuring Client Credentials grant and Bearer tokens.c         K@ s„   t  | ƒ } t | | | | ƒ } t j |  d d d i | d 6d | ƒt j |  d d d i | d 6ƒt j |  | d d	 g ƒd
 S(   uû  Construct a client credentials grant server.

        :param request_validator: An implementation of
                                  oauthlib.oauth2.RequestValidator.
        :param token_expires_in: An int or a function to generate a token
                                 expiration offset (in seconds) given a
                                 oauthlib.common.Request object.
        :param token_generator: A function to generate a token from a request.
        :param refresh_token_generator: A function to generate a token from a
                                        request for the refresh token.
        :param kwargs: Extra parameters to pass to authorization-,
                       token-, resource-, and revocation-endpoint constructors.
        R   u   client_credentialsR   R   R   u   BearerR   R(   u   access_tokenN(   R   R   R	   R   R
   R   (   R   R   R   R   R   R   R   R!   (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR   ¸   s    	
N(   R"   R#   R$   R%   R   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyR*   ³   s   N(   R$   t
   __future__R    R   t   tokensR   R   R   R   R   R   R   t   authorizationR   t   tokenR	   t   resourceR
   t
   revocationR   R   R&   R'   R)   R*   (    (    (    sR   /tmp/pip-unpacked-wheel-eAx2J6/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyt   <module>   s*   /%	 	#	