
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
,['0                 @   s   d Z ddlmZmZ ddlmZmZmZ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 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ZG dd deeeZG dd deeeZdS )z
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
    )absolute_importunicode_literals   )AuthCodeGrantDispatcherAuthorizationCodeGrantClientCredentialsGrantImplicitGrantOpenIDConnectAuthCodeOpenIDConnectImplicitRefreshTokenGrant%ResourceOwnerPasswordCredentialsGrant)BearerToken   )AuthorizationEndpoint)ResourceEndpoint)RevocationEndpoint)TokenEndpointc               @   s   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|}t||||}t||d}t	j
| d||||||||d|d tj
| d||	|
||d|d tj
| dd|id	 tj
| | 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.
        )Zdefault_auth_grantZoidc_auth_grantcode)r   tokenZid_tokenzid_token tokenz
code tokenzcode id_tokenzcode token id_tokenZnone)default_response_typeresponse_typesdefault_token_typeauthorization_code)r   passwordclient_credentialsrefresh_tokenZopenid)default_grant_typegrant_typesr   Bearer)default_tokentoken_typesN)r   r   r   r   r   r	   r
   r   r   r   __init__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_grantZopenid_connect_authZopenid_connect_implicitbearerZauth_grant_choice r0   $/usr/lib/python3.6/pre_configured.pyr"      s>    zServer.__init__)NNN)__name__
__module____qualname____doc__r"   r0   r0   r0   r1   r      s    r   c               @   s   e Zd ZdZdddZdS )WebApplicationServerzLAn all-in-one endpoint featuring Authorization code grant and Bearer tokens.Nc       	      K   sp   t |}t|}t||||}tj| dd|i|d tj| d||d|d tj| dd|id tj| | 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   r   r   r   )r    r!   N)r   r   r   r   r"   r   r   r   )	r#   r$   r&   r%   r'   r)   r*   r.   r/   r0   r0   r1   r"   [   s    zWebApplicationServer.__init__)NNN)r2   r3   r4   r5   r"   r0   r0   r0   r1   r6   V   s    r6   c               @   s   e Zd ZdZdddZdS )MobileApplicationServerzGAn all-in-one endpoint featuring Implicit code grant and Bearer tokens.Nc             K   sV   t |}t||||}tj| dd|i|d tj| dd|i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   r   )r    r!   access_token)supported_token_typesN)r   r   r   r"   r   r   )r#   r$   r&   r%   r'   r)   r+   r/   r0   r0   r1   r"      s    z MobileApplicationServer.__init__)NNN)r2   r3   r4   r5   r"   r0   r0   r0   r1   r7   |   s    r7   c               @   s   e Zd ZdZdddZdS )LegacyApplicationServerz]An all-in-one endpoint featuring Resource Owner Password Credentials grant and Bearer tokens.Nc       	      K   sZ   t |}t|}t||||}tj| d||d|d tj| dd|id tj| | 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   r   )r    r!   N)r   r   r   r   r"   r   r   )	r#   r$   r&   r%   r'   r)   r,   r.   r/   r0   r0   r1   r"      s    z LegacyApplicationServer.__init__)NNN)r2   r3   r4   r5   r"   r0   r0   r0   r1   r:      s    r:   c               @   s   e Zd ZdZdddZdS )BackendApplicationServerzLAn all-in-one endpoint featuring Client Credentials grant and Bearer tokens.Nc             K   sV   t |}t||||}tj| dd|i|d tj| dd|id tj| |dgd dS )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    r!   r8   )r9   N)r   r   r   r"   r   r   )r#   r$   r&   r%   r'   r)   r-   r/   r0   r0   r1   r"      s    z!BackendApplicationServer.__init__)NNN)r2   r3   r4   r5   r"   r0   r0   r0   r1   r;      s    r;   N)r5   Z
__future__r   r   r   r   r   r   r   r	   r
   r   r   tokensr   Zauthorizationr   Zresourcer   Z
revocationr   r   r   r   r6   r7   r:   r;   r0   r0   r0   r1   <module>   s"   (>% #