403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.216.1.197
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/paste/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/auth/__pycache__/open_id.cpython-37.pyc
B

a�N�?�@s�dZdgZddlZddlZddlZddlZddlmZdd�Zddl	m
Z
ddlmZdd	l
mZGd
d�de�ZeZdd
d�ZdS)a�
OpenID Authentication (Consumer)

OpenID is a distributed authentication system for single sign-on originally
developed at/for LiveJournal.com.

    http://openid.net/

URL. You can have multiple identities in the same way you can have multiple
URLs. All OpenID does is provide a way to prove that you own a URL (identity).
And it does this without passing around your password, your email address, or
anything you don't want it to. There's no profile exchange component at all:
your profiile is your identity URL, but recipients of your identity can then
learn more about you from any public, semantically interesting documents
linked thereunder (FOAF, RSS, Atom, vCARD, etc.).

``Note``: paste.auth.openid requires installation of the Python-OpenID
libraries::

    http://www.openidenabled.com/

This module is based highly off the consumer.py that Python OpenID comes with.

Using the OpenID Middleware
===========================

Using the OpenID middleware is fairly easy, the most minimal example using the
basic login form thats included::

    # Add to your wsgi app creation
    from paste.auth import open_id

    wsgi_app = open_id.middleware(wsgi_app, '/somewhere/to/store/openid/data')

You will now have the OpenID form available at /oid on your site. Logging in will
verify that the login worked.

A more complete login should involve having the OpenID middleware load your own
login page after verifying the OpenID URL so that you can retain the login
information in your webapp (session, cookies, etc.)::

    wsgi_app = open_id.middleware(wsgi_app, '/somewhere/to/store/openid/data',
                                  login_redirect='/your/login/code')

Your login code should then be configured to retrieve 'paste.auth.open_id' for
the users OpenID URL. If this key does not exist, the user has not logged in.

Once the login is retrieved, it should be saved in your webapp, and the user
should be redirected to wherever they would normally go after a successful
login.
�AuthOpenIDHandler�N)�httpexceptionscCst�|d�}d|fS)N�z"%s")�cgi�escape)�s�qs�r	�C/opt/alt/python37/lib/python3.7/site-packages/paste/auth/open_id.py�	quoteattrAsr)�	filestore)�consumer)�
appendArgsc@sleZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
dd�ZdS) rzq
    This middleware implements OpenID Consumer behavior to authenticate a
    URL against an OpenID Server.
    �/oidNFcCs>t�|�}t�|�|_||_||_||_||_||_	||_
dS)a�
        Initialize the OpenID middleware

        ``app``
            Your WSGI app to call
            
        ``data_store_path``
            Directory to store crypto data in for use with OpenID servers.
            
        ``auth_prefix``
            Location for authentication process/verification
            
        ``login_redirect``
            Location to load after successful process of login
            
        ``catch_401``
            If true, then any 401 responses will turn into open ID login
            requirements.
            
        ``url_to_username``
            A function called like ``url_to_username(environ, url)``, which should
            return a string username.  If not given, the URL will be the username.
        N)rZFileOpenIDStorer
ZOpenIDConsumer�oidconsumer�app�auth_prefix�data_store_path�login_redirect�	catch_401�url_to_username)�selfrrrrrr�storer	r	r
�__init__Us
zAuthOpenIDHandler.__init__cCs�|d�|j�r�t||gd�}tjj|ddd�|d<t�|jd|d�}t�|�|d<ttj�	|��|d<|dd	}|d
ks�|s�|�
|�S|dkr�|�|�S|dkr�|�|�S|�
|�Sn|jr�|�||�S|�||�SdS)
N�	PATH_INFO)�environ�start�bodyF)�with_path_info�with_query_string�base_url��
parsed_uri�query��/z/verifyz/process)�
startswithr�dict�paste�request�
construct_url�re�sub�urlparseZparse_querystring�render�	do_verify�
do_process�	not_foundr�catch_401_app_callr)rr�start_responser)�pathr	r	r
�__call__ys$



zAuthOpenIDHandler.__call__c	svg�d��fdd�	}|�||�}�rnzt|�Wdt|d�rD|��Xtjj|ddd�}t�|�}|�	|��S|SdS)zV
        Call the application, and redirect if the app returns a 401 response
        Ncs:t|�dd��dkr*��d�dd�}|S�|||�SdS)Nri�cSsdS)Nr	)�vr	r	r
�dummy_writer�sz^AuthOpenIDHandler.catch_401_app_call.<locals>.replacement_start_response.<locals>.dummy_writer)�int�split�append)�status�headers�exc_infor7)r3�was_401r	r
�replacement_start_response�s

zHAuthOpenIDHandler.catch_401_app_call.<locals>.replacement_start_response�closeF)rr)N)
r�list�hasattrr@r(r)r*rZHTTPTemporaryRedirectZwsgi_application)rrr3r?Zapp_iterZ	redir_url�excr	)r3r>r
r2�s




z$AuthOpenIDHandler.catch_401_app_callc
Cs�|d�d�}|s$|j|dd|d�S|j}|�|�\}}|tjtjgkr~|tjkrXd}nd}|t�|�f}|j||d|d�S|tj	kr�|j
|d|jd	�}|j|||d
d�}	|�
||	�Sds�td
��dS)zDProcess the form submission, initating OpenID verification.
        r#�
openid_urlz Enter an identity URL to verify.�error)�	css_class�
form_contentszFailed to retrieve <q>%s</q>z.Could not find OpenID information in <q>%s</q>�process)�tokenr )Z
trust_rootFzNot reachedN)�getr.rZ	beginAuthr
ZHTTP_FAILUREZPARSE_ERRORrr�SUCCESS�	build_urlrIZconstructRedirect�redirect�AssertionError)
rr)rDrr;�info�fmt�messageZ	return_to�redirect_urlr	r	r
r/�s$


zAuthOpenIDHandler.do_verifycCs|j}|d�dd�}|�||d�\}}d}d}|tjkrZ|rZ|}d}|t�|�f}	n�|tjkr�d}|r�|}|jr�|�|d|�}
n|}
d	|dkr�|dd	|
�|j	s�d
}|t�|�f}	q�||dd<|j	|dd<|�
|d|d
�Sq�d}	nd}	|�||	||�S)z4Handle the redirect from the OpenID server.
        r#rIr!rENzVerification of %s failed.�alertrzpaste.auth_tkt.set_userz�If you had supplied a login redirect path, you would have been redirected there.  You have successfully verified %s as your identity.zpaste.auth.open_idrrzVerification cancelledzVerification failed.)rrJZcompleteAuthr
�FAILURErrrKrrrr.)rr)rrIr;rOrFrDrPrQ�usernamer	r	r
r0�s6
zAuthOpenIDHandler.do_processcKs$t�|d|jd|�}t||�S)z[Build a URL relative to the server base_url, with the given
        query parameters added.r r%)r-�urljoinrr)rr)�actionr#�baser	r	r
rL!szAuthOpenIDHandler.build_urlcCs$dd|fg}|dd|�d|gS)z9Send a redirect response to the given URL to the browser.)zContent-typez
text/plainZLocationrz302 REDIRECTzRedirecting to %sr	)rr)rR�response_headersr	r	r
rM's
zAuthOpenIDHandler.redirectcCs4d}||df}|d�d�}|j||d|dd�S)z3Render a page with a 404 return code and a message.z5The path <q>%s</q> was not understood by this server.r"r#rDrEz
404 Not Found)r;)rJr.)rr)rP�msgrDr	r	r
r1.szAuthOpenIDHandler.not_foundrS�200 OK�Python OpenID ConsumercCsldg}|dt|�|�|�||�|rX|d�d|f�|d�|�|d�d�|�||�|dS)zRender a page.)zContent-typez	text/htmlrrz<div class='%s'>z</div>)�str�page_headerr:�page_footer)rr)rQrFrGr;�titlerYr	r	r
r.5szAuthOpenIDHandler.rendercCs|d�d||f�dS)zRender the page headerraT<html>
  <head><title>%s</title></head>
  <style type="text/css">
      * {
        font-family: verdana,sans-serif;
      }
      body {
        width: 50em;
        margin: 1em;
      }
      div {
        padding: .5em;
      }
      table {
        margin: none;
        padding: none;
      }
      .alert {
        border: 1px solid #e7dc2b;
        background: #fff888;
      }
      .error {
        border: 1px solid #ff0000;
        background: #ffaaaa;
      }
      #verify-form {
        border: 1px solid #777777;
        background: #dddddd;
        margin-top: 1em;
        padding-bottom: 0em;
      }
  </style>
  <body>
    <h1>%s</h1>
    <p>
      This example consumer uses the <a
      href="http://openid.schtuff.com/">Python OpenID</a> library. It
      just verifies that the URL that you enter is your identity URL.
    </p>
N)r:)rr)r`r	r	r
r^Cs(zAuthOpenIDHandler.page_headercCs2|sd}|d�dt|�|d��t|�f�dS)zRender the page footerr!rz�    <div id="verify-form">
      <form method="get" action=%s>
        Identity&nbsp;URL:
        <input type="text" name="openid_url" value=%s />
        <input type="submit" value="Verify" />
      </form>
    </div>
  </body>
</html>
ZverifyN)r:rrL)rr)rGr	r	r
r_os
zAuthOpenIDHandler.page_footer)rNFN)NrSNr[r\)�__name__�
__module__�__qualname__�__doc__rr5r2r/r0rLrMr1r.r^r_r	r	r	r
rOs
"3?

,�/oidFc	
Cs|ddlm}	ddlm}
|	|�}|r8t|t�r8|
�|�}|	|�}t||||||pRdd�}|rxddlm	}|j
|||d�}|S)Nr)�asbool)�
import_string)rrrrr)�auth_tkt)Zlogout_path)Zpaste.deploy.convertersrfZ
paste.utilrg�
isinstance�
basestringZeval_importrZ
paste.authrhZmake_auth_tkt_middleware)
rZglobal_confrrrrrZapply_auth_tktZauth_tkt_logout_pathrfrgZnew_apprhr	r	r
�make_open_id_middleware�s
rk)reNFNFN)rd�__all__rr-r+Z
paste.requestr(rrZopenid.storerZopenid.consumerr
Zopenid.oidutilr�objectrZ
middlewarerkr	r	r	r
�<module>6s(
4

Youez - 2016 - github.com/yon3zu
LinuXploit