File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/__pycache__/auth.cpython-310.pyc
Back
o ;j�� � @ s� d Z ddlmZmZmZ ddlZddlZddlZddlZddl Z ddl Z ddlZddlm Z mZmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZmZ erqddlmZ ddlmZ! e"Z#nddl Z ddl$Z!G dd � d e%�Z&dd� Z'dd� Z(G dd� de)�Z*G dd� de)�Z+G dd� de)�Z,G dd� de+�Z-G dd� de,�Z.G dd� de,�Z/i dfdd�Z0i dfd d!�Z1d"d#� Z2d$d%� Z3dS )&aK This module contains implementations of various third-party authentication schemes. All the classes in this file are class mixins designed to be used with the `tornado.web.RequestHandler` class. They are used in two ways: * On a login handler, use methods such as ``authenticate_redirect()``, ``authorize_redirect()``, and ``get_authenticated_user()`` to establish the user's identity and store authentication tokens to your database and/or cookies. * In non-login handlers, use methods such as ``facebook_request()`` or ``twitter_request()`` to use the authentication tokens to make requests to the respective services. They all take slightly different arguments due to the fact all these services implement authentication and authorization slightly differently. See the individual service classes below for complete documentation. Example usage for Google OAuth: .. testcode:: class GoogleOAuth2LoginHandler(tornado.web.RequestHandler, tornado.auth.GoogleOAuth2Mixin): @tornado.gen.coroutine def get(self): if self.get_argument('code', False): user = yield self.get_authenticated_user( redirect_uri='http://your.site.com/auth/google', code=self.get_argument('code')) # Save the user with e.g. set_secure_cookie else: yield self.authorize_redirect( redirect_uri='http://your.site.com/auth/google', client_id=self.settings['google_oauth']['key'], scope=['profile', 'email'], response_type='code', extra_params={'approval_prompt': 'auto'}) .. testoutput:: :hide: .. versionchanged:: 4.0 All of the callback interfaces in this module are now guaranteed to run their callback with an argument of ``None`` on error. Previously some functions would do this while others would simply terminate the request on their own. This change also ensures that errors are more consistently reported through the ``Future`` interfaces. � )�absolute_import�division�print_functionN)�TracebackFuture� return_future�chain_future)�gen)� httpclient)�escape)� url_concat)�gen_log)�ExceptionStackContext)�unicode_type�ArgReplacer�PY3c @ s e Zd ZdS )� AuthErrorN)�__name__� __module__�__qualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/auth.pyr a s r c C sP z|� � }W n ty! } zt�t|�� d }W Y d }~nd }~ww | |� d S �N)�resultr r �warning�str)�callback�futurer �er r r �_auth_future_to_callbacke s ��r c s&