o
    ‘¸õa².  ã                   @   sÞ   d Z ddlmZmZmZ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 G d
d„ de
eeeeƒZG dd„ de
eeeeƒZG dd„ de
eeeƒZG dd„ deeeeƒZG dd„ deeeeƒZdS )zÊ
oauthlib.oauth2.rfc6749.endpoints.pre_configured
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various endpoints needed
for providing OAuth 2.0 RFC6749 servers.
é   )ÚAuthorizationCodeGrantÚClientCredentialsGrantÚImplicitGrantÚRefreshTokenGrantÚ%ResourceOwnerPasswordCredentialsGrant)ÚBearerTokené   )ÚAuthorizationEndpoint)ÚIntrospectEndpoint)ÚResourceEndpoint)ÚRevocationEndpoint)ÚTokenEndpointc                   @   ó   e Zd ZdZ		ddd„ZdS )ÚServerz<An all-in-one endpoint featuring all four major grant types.Nc                 O   s¼   t |ƒ| _t|ƒ| _t|ƒ| _t|ƒ| _t|ƒ| _	t
||||ƒ| _tj| d| j| j| jdœ| jd� tj| d| j| j| j| j	dœ| jd� tj| dd| jid� t | |¡ t | |¡ d	S )
aø  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.
        Úcode)r   ÚtokenÚnone©Údefault_response_typeÚresponse_typesÚdefault_token_typeÚauthorization_code)r   ÚpasswordÚclient_credentialsÚrefresh_token©Údefault_grant_typeÚgrant_typesr   ÚBearer©Údefault_tokenÚtoken_typesN)r   Ú
auth_grantr   Úimplicit_grantr   Úpassword_grantr   Úcredentials_grantr   Úrefresh_grantr   Úbearerr	   Ú__init__r   r   r   r
   )ÚselfÚrequest_validatorÚtoken_expires_inÚtoken_generatorÚrefresh_token_generatorÚargsÚkwargs© r0   úR/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyr(      s<   

ÿ

ÿýúüùÿzServer.__init__©NNN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   r0   r0   r0   r1   r      ó
    ÿr   c                   @   r   )ÚWebApplicationServerzLAn all-in-one endpoint featuring Authorization code grant and Bearer tokens.Nc                 K   sŽ   t |ƒ| _t|ƒ| _t||||ƒ| _tj| dd| ji| jd� tj| d| j| jdœ| jd� t	j| dd| jid� t
 | |¡ t | |¡ dS )	aö  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   r   r   )r   r   r   r   r   N)r   r"   r   r&   r   r'   r	   r(   r   r   r   r
   ©r)   r*   r,   r+   r-   r/   r0   r0   r1   r(   N   s(   

ÿþþûÿzWebApplicationServer.__init__r2   r3   r0   r0   r0   r1   r9   I   r8   r9   c                   @   r   )ÚMobileApplicationServerzGAn all-in-one endpoint featuring Implicit code grant and Bearer tokens.Nc                 K   ór   t |ƒ| _t||||ƒ| _tj| dd| ji| jd� tj| dd| jid� tj| |dgd� tj| |dgd� dS )aõ  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   r   r   r   Úaccess_token©Úsupported_token_typesN)	r   r#   r   r'   r	   r(   r   r   r
   r:   r0   r0   r1   r(   u   ó$   
ÿÿýÿÿ
ÿz MobileApplicationServer.__init__r2   r3   r0   r0   r0   r1   r;   p   r8   r;   c                   @   r   )ÚLegacyApplicationServerz]An all-in-one endpoint featuring Resource Owner Password Credentials grant and Bearer tokens.Nc                 K   st   t |ƒ| _t|ƒ| _t||||ƒ| _tj| d| j| jdœ| jd� tj| dd| jid� t	 | |¡ t
 | |¡ dS )a  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   )r   r   r   r   r   N)r   r$   r   r&   r   r'   r   r(   r   r   r
   r:   r0   r0   r1   r(   ˜   s$   ÿ
ÿþûÿz LegacyApplicationServer.__init__r2   r3   r0   r0   r0   r1   rA   “   r8   rA   c                   @   r   )ÚBackendApplicationServerzLAn all-in-one endpoint featuring Client Credentials grant and Bearer tokens.Nc                 K   r<   )aû  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   r   r   r   r=   r>   N)	r   r%   r   r'   r   r(   r   r   r
   r:   r0   r0   r1   r(   ½   r@   z!BackendApplicationServer.__init__r2   r3   r0   r0   r0   r1   rB   ¸   r8   rB   N)r7   r   r   r   r   r   r   Útokensr   Úauthorizationr	   Ú
introspectr
   Úresourcer   Ú
revocationr   r   r   r   r9   r;   rA   rB   r0   r0   r0   r1   Ú<module>   s.    ÿ5ÿ'ÿ#ÿ%ÿ