o
    ˷6i-                     @   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 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)TokenEndpoint    )DeviceCodeGrantc                   @       e Zd ZdZ			dddZdS )Serverz_
    An all-in-one endpoint featuring all four major grant types
    and extension grants.
    Nc              	   O   s   t || _t|| _t|| _t|| _t|| _	t
|fi || _t||||| _tj| d| j| j| jd| jd tj| d| j| 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_tokenz,urn:ietf:params:oauth:grant-type:device_codedefault_grant_typegrant_typesr   Bearerdefault_tokentoken_typesN)r   
auth_grantr   implicit_grantr   password_grantr   credentials_grantr   refresh_grantr   device_code_grantr   bearerr	   __init__r   r   r   r
   )selfrequest_validatortoken_expires_intoken_generatorrefresh_token_generatorargskwargs r3   u/var/www/hoanhtaovolam_webdjango/env/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyr+   !   sD   




zServer.__init__NNN__name__
__module____qualname____doc__r+   r3   r3   r3   r4   r      s    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.   r0   r2   r3   r3   r4   r+   e   s0   

	zWebApplicationServer.__init__r5   r6   r3   r3   r3   r4   r;   `       r;   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<   r3   r3   r4   r+      &   

z MobileApplicationServer.__init__r5   r6   r3   r3   r3   r4   r>      r=   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<   r3   r3   r4   r+      s$   

	z LegacyApplicationServer.__init__r5   r6   r3   r3   r3   r4   rD      r=   rD   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@   rA   N)	r   r'   r   r*   r   r+   r   r   r
   r<   r3   r3   r4   r+      rC   z!BackendApplicationServer.__init__r5   r6   r3   r3   r3   r4   rE      r=   rE   N)r:   r   r   r   r   r   r   tokensr   authorizationr	   
introspectr
   resourcer   
revocationr   r   r   #oauthlib.oauth2.rfc8628.grant_typesr   r   r;   r>   rD   rE   r3   r3   r3   r4   <module>   s0    


G

5
/
/