
    *              	          d Z ddlmZm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eeeee      Z G d deeeee      Z G d deeee      Z G d deeee      Z G d deeee      Zy)zoauthlib.oauth2.rfc6749.endpoints.pre_configured ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various endpoints needed
for providing OAuth 2.0 RFC6749 servers.
    )absolute_importunicode_literals   )AuthorizationCodeGrantClientCredentialsGrantImplicitGrantRefreshTokenGrant%ResourceOwnerPasswordCredentialsGrant)BearerToken   )AuthorizationEndpoint)IntrospectEndpoint)ResourceEndpoint)RevocationEndpoint)TokenEndpointc                       e Zd ZdZ	 	 	 ddZy)Serverz<An all-in-one endpoint featuring all four major grant types.Nc           	         t        |      }t        |      }t        |      }	t        |      }
t	        |      }t        ||||      }t        j                  | d|||d|       t        j                  | d||	|
|d|       t        j                  | dd|i       t        j                  | |       t        j                  | |       y	)
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   r   r
   r   r	   r   r   __init__r   r   r   r   )selfrequest_validatortoken_expires_intoken_generatorrefresh_token_generatorargskwargs
auth_grantimplicit_grantpassword_grantcredentials_grantrefresh_grantbearers                Clib/third_party/oauthlib/oauth2/rfc6749/endpoints/pre_configured.pyr'   zServer.__init__   s    ( ((9:J"#45N:;LMN./@A%&78M*O=M02F ""$#

 "# /",&"3*	
 "	# H8V2DF&78&78    NNN__name__
__module____qualname____doc__r'    r6   r5   r   r      s    D !%#'+	49r6   r   c                       e Zd ZdZ	 	 	 ddZy)WebApplicationServerzLAn all-in-one endpoint featuring Authorization code grant and Bearer tokens.Nc                 F   t        |      }t        |      }t        ||||      }t        j                  | dd|i|       t        j                  | d||d|       t        j                  | dd|i       t        j                  | |       t        j                  | |       y)	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/   r3   r4   s	            r5   r'   zWebApplicationServer.__init__S   s    & ((9:J%&78M*O=M02F""$
+!	#
 /",*
 "# H8V2DF&78&78r6   r7   r8   r=   r6   r5   r?   r?   O   s    T  $ $'+	'9r6   r?   c                       e Zd ZdZ	 	 	 ddZy)MobileApplicationServerzGAn all-in-one endpoint featuring Implicit code grant and Bearer tokens.Nc                    t        |      }t        ||||      }t        j                  | dd|i|       t	        j                  | dd|i       t        j                  | |dg       t        j                  | |dg       y)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+   r*   r,   r.   r0   r4   s           r5   r'   z MobileApplicationServer.__init__   s    & ##45N*O=M02F""%0!	#
 H8V2DF7GI7GIr6   r7   r8   r=   r6   r5   rB   rB   }   s    O  $ $'+	 Ir6   rB   c                       e Zd ZdZ	 	 	 ddZy)LegacyApplicationServerz]An all-in-one endpoint featuring Resource Owner Password Credentials grant and Bearer tokens.Nc                    t        |      }t        |      }t        ||||      }t        j                  | d||d|       t        j                  | dd|i       t        j                  | |       t        j                  | |       y)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*   r,   r.   r1   r3   r4   s	            r5   r'   z LegacyApplicationServer.__init__   s    & ;;LMN%&78M*O=M02F%&*
 "# H8V2DF&78&78r6   r7   r8   r=   r6   r5   rH   rH      s    e  $ $'+	"9r6   rH   c                       e Zd ZdZ	 	 	 ddZy)BackendApplicationServerzLAn all-in-one endpoint featuring Client Credentials grant and Bearer tokens.Nc                    t        |      }t        ||||      }t        j                  | dd|i|       t	        j                  | dd|i       t        j                  | |dg       t        j                  | |dg       y)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$   rD   rE   N)r   r   r   r'   r   r   r   )r(   r)   r+   r*   r,   r.   r2   r4   s           r5   r'   z!BackendApplicationServer.__init__   s    & //@A*O=M02F/)+<=!	#
 H8V2DF7GI7GIr6   r7   r8   r=   r6   r5   rK   rK      s    T  $ $'+	 Ir6   rK   N)r<   
__future__r   r   r"   r   r   r   r	   r
   tokensr   authorizationr   
introspectr   resourcer   
revocationr   r   r   r   r?   rB   rH   rK   r=   r6   r5   <module>rS      s   
 9B B ! 0 * & *  89"$6189v+902D(*:<N+9\$I35G.0B$IN&9m-?.0B&9R$I}.@/1C$Ir6   