403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/openid/consumer/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/openid/consumer/__pycache__/discover.cpython-311.pyc
�

QT�^.?��B�dZgd�ZddlZddlZddlmZmZddlmZddl	m
Z
mZmZddl
mZddlmZdd	lmZdd
lmZmZddlmZddlmZd
ZdZdZdZdZddlm Z!ddlm"Z#ej$e%��Z&Gd�de'��Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�ZdS) z9Functions to discover OpenID endpoints from identifiers.
)�DiscoveryFailure�
OPENID_1_0_NS�OPENID_1_0_TYPE�OPENID_1_1_TYPE�OPENID_2_0_TYPE�OPENID_IDP_2_0_TYPE�OpenIDServiceEndpoint�discover�N)�fetchers�urinorm)�yadis)�nsTag�	XRDSError�
XRD_NS_2_0)�applyFilter)r	)r)�xrires�filters��xri)�
html_parsezhttp://openid.net/xmlns/1.0z'http://specs.openid.net/auth/2.0/serverz'http://specs.openid.net/auth/2.0/signonzhttp://openid.net/signon/1.1zhttp://openid.net/signon/1.0)�
OPENID1_NS)�
OPENID2_NSc���eZdZdZeeeegZd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zee��Zd�Zee��Zd
�Zee��Zd�Zee��Zd�Zee��Zd�ZdS)rz�Object representing an OpenID service endpoint.

    @ivar identity_url: the verified identifier.
    @ivar canonicalID: For XRI, the persistent identifier.
    c�h�d|_d|_g|_d|_d|_d|_d|_dS)NF)�
claimed_id�
server_url�	type_uris�local_id�canonicalID�
used_yadis�display_identifier��selfs �:/usr/lib/python3/dist-packages/openid/consumer/discover.py�__init__zOpenIDServiceEndpoint.__init__;s;�������������
�������"&�����c��||jvS�N)r)r#�
extension_uris  r$�
usesExtensionz#OpenIDServiceEndpoint.usesExtensionDs�����.�.r&c�V�t|jvst|jvrtStSr()rrr�OPENID_2_0_MESSAGE_NS�OPENID_1_0_MESSAGE_NSr"s r$�preferredNamespacez(OpenIDServiceEndpoint.preferredNamespaceGs(���4�>�1�1��4�>�1�1�(�(�(�(r&c�R�||jvp|tko|���S)zyDoes this endpoint support this type?

        I consider C{/server} endpoints to implicitly support C{/signon}.
        )rr�isOPIdentifier)r#�type_uris  r$�supportsTypez"OpenIDServiceEndpoint.supportsTypeNs3��
�T�^�+�H��_�,�F��1D�1D�1F�1F�	Ir&c��|j�|jS|j�dStj�|j��dS)zJReturn the display_identifier if set, else return the claimed_id.
        Nr
)r!r�urllib�parse�	urldefragr"s r$�getDisplayIdentifierz*OpenIDServiceEndpoint.getDisplayIdentifierVs@���"�.��*�*��?�"��4��<�)�)�$�/�:�:�1�=�=r&c�<�|���tkSr()r.r,r"s r$�compatibilityModez'OpenIDServiceEndpoint.compatibilityMode`s���&�&�(�(�,A�A�Ar&c��t|jvSr()rrr"s r$r0z$OpenIDServiceEndpoint.isOPIdentifiercs��"�d�n�4�4r&c��||_||_d|_|���s#t	||j��|_||_dSdS)zRSet the state of this object based on the contents of the
        service element.TN)rrr r0�findOPLocalIdentifierrr)r#�	yadis_url�urir�service_elements     r$�parseServicez"OpenIDServiceEndpoint.parseServicefs^��#����������"�"�$�$�	(�
2�/�26�.�B�B�D�M�'�D�O�O�O�	(�	(r&c�T�|j|jcxur�
nn|jS|jp|jS)zaReturn the identifier that should be sent as the
        openid.identity parameter to the server.)rrrr"s r$�
getLocalIDz OpenIDServiceEndpoint.getLocalIDvs>��
�M�T�-�5�5�5�5�5�5�5�5��?�"��=�4�D�$4�4r&c��|�|j��}|r>|j�7|��}|�|j|j|j|j��nd}|S)z�Create a new instance of this class from the endpoint
        object passed in.

        @return: None or OpenIDServiceEndpoint for this endpoint objectN)�
matchTypes�openid_type_urisr>r@r=rr?)�cls�endpointr�openid_endpoints    r$�fromBasicServiceEndpointz.OpenIDServiceEndpoint.fromBasicServiceEndpoint�sy��
�'�'��(<�=�=�	��	#���1�!�c�e�e�O��(�(��);�X�\�)1�);�)1�)A�
C�
C�
C�
C�#�O��r&c�:�tddftddfg}tj|��}g}|D]m\}}}tj||��}	|	��|��}
||
_tj||��|
_|	|
_|g|
_|�	|
���n|S)zParse the given document as HTML looking for an OpenID <link
        rel=...>

        @rtype: [OpenIDServiceEndpoint]
        zopenid2.providerzopenid2.local_idz
openid.serverzopenid.delegate)
rrr�parseLinkAttrs�
findFirstHrefrrrr�append)rFr>�html�discovery_types�
link_attrs�servicesr1�op_endpoint_rel�local_id_rel�op_endpoint_url�services           r$�fromHTMLzOpenIDServiceEndpoint.fromHTML�s����0�2D�E�
�o�/@�A�
��
 �.�t�4�4�
���7F�
	%�
	%�3�H�o�|�(�6�z�7F�H�H�O��&���c�e�e�G�!$�G��)�7�
�8D� F� F�G��!0�G��!)�
�G���O�O�G�$�$�$�$��r&c�$�t|||��S)z�Parse the given document as XRDS looking for OpenID services.

        @rtype: [OpenIDServiceEndpoint]

        @raises XRDSError: When the XRDS does not parse.

        @since: 2.1.0
        )�extractServices)rFr>�xrdss   r$�fromXRDSzOpenIDServiceEndpoint.fromXRDS�s���s�D�#�.�.�.r&c�t�|���r|j}n|j}||j|j��S)z�Create endpoints from a DiscoveryResult.

        @type discoveryResult: L{DiscoveryResult}

        @rtype: list of L{OpenIDServiceEndpoint}

        @raises XRDSError: When the XRDS does not parse.

        @since: 2.1.0
        )�isXRDSrZrV�normalized_uri�
response_text)rF�discoveryResult�methods   r$�fromDiscoveryResultz)OpenIDServiceEndpoint.fromDiscoveryResult�sG���!�!�#�#�	"��\�F�F��\�F��v�o�4�%�3�5�5�	5r&c�B�|��}||_tg|_|S)z�Construct an OP-Identifier OpenIDServiceEndpoint object for
        a given OP Endpoint URL

        @param op_endpoint_url: The URL of the endpoint
        @rtype: OpenIDServiceEndpoint
        )rrr)rFrTrUs   r$�fromOPEndpointURLz'OpenIDServiceEndpoint.fromOPEndpointURL�s'���#�%�%��,���0�1����r&c��d|jj�d|jj�d|j�d|j�d|j�d|j�d|j�d�S)	N�<�.z server_url=z claimed_id=z
 local_id=z
 canonicalID=z used_yadis=z >)�	__class__�
__module__�__name__rrrrr r"s r$�__str__zOpenIDServiceEndpoint.__str__�sX����~�0�0�0�$�.�2I�2I�2I��������������'�'�'�����:�	;r&N)rirh�__qualname__�__doc__rrrrrEr%r*r.r2r7r9r0r@rBrI�classmethodrVrZrarcrj�r&r$rr+sv��������	����	��'�'�'�/�/�/�)�)�)�I�I�I�>�>�>�B�B�B�5�5�5�(�(�(� 
5�
5�
5����& +�{�+C�D�D�����<�{�8�$�$�H�	/�	/�	/��{�8�$�$�H�5�5�5�$&�+�&9�:�:��
�
�
�$��$5�6�6��	;�	;�	;�	;�	;r&rc�x�g}t|vs	t|vr(|�ttd����t
|vr(|�ttd����d}|D]G}|�|��D]/}|�|j}�||jkrd}||fz}t|d����0�H|S)aFind the OP-Local Identifier for this xrd:Service element.

    This considers openid:Delegate to be a synonym for xrd:LocalID if
    both OpenID 1.X and OpenID 2.0 types are present. If only OpenID
    1.X is present, it returns the value of openid:Delegate. If only
    OpenID 2.0 is present, it returns the value of xrd:LocalID. If
    there is more than one LocalID tag and the values are different,
    it raises a DiscoveryFailure. This is also triggered when the
    xrd:LocalID and openid:Delegate tags are different.

    @param service_element: The xrd:Service element
    @type service_element: ElementTree.Node

    @param type_uris: The xrd:Type values present in this service
        element. This function could extract them, but higher level
        code needs to do that anyway.
    @type type_uris: [str]

    @raises DiscoveryFailure: when discovery fails.

    @returns: The OP-Local Identifier for this service element, if one
        is present, or None otherwise.
    @rtype: str or unicode or NoneType
    �Delegate�LocalIDNz1More than one %r tag found in one service element)
rrrMrrrr�findall�textr)r?r�
local_id_tagsr�local_id_tag�local_id_element�format�messages        r$r<r<�s���8�M��9�$�$��9�(D�(D����U�=�*�=�=�>�>�>��)�#�#����U�:�y�9�9�:�:�:��H�%�6�6�� /� 7� 7�� E� E�	6�	6����+�0����-�2�2�2�L�� �L�#3�3��&�w��5�5�5�3�	6��Or&c��	tj|��}tj�|��dS#t$r}td|��d���d}~wwxYw)zJNormalize a URL, converting normalization failures to
    DiscoveryFailurer
zNormalizing identifier: N)rr4r5r6�
ValueErrorr)�url�
normalized�whys   r$�normalizeURLr~$sp��5��_�S�)�)�
��|�%�%�j�1�1�!�4�4���M�M�M���s�s�E�t�L�L�L�����M���s�;�
A�A�Ac�:�|jd��r
|dd�}|S)z1Normalize an XRI, stripping its scheme if presentzxri://�N)�
startswithrs r$�normalizeXRIr�/s(���s�~�h�����!�"�"�g���Jr&c������d����fd���fd��|��D��}|���tt|����D]}||d||<�|S)zzRearrange service_list in a new list so services are ordered by
    types listed in preferred_types.  Return the new list.c��ttttt|������|����S)zvReturn an iterable that pairs the index of an element with
        that element.

        For Python 2.2 compatibility)�list�zip�range�len)�eltss r$�	enumeratez arrangeByType.<locals>.enumerate:s2��
�C��U�3�t�9�9�-�-�.�.��5�5�6�6�6r&c�j������D]\}}�||jvr|cS�t���S)auReturn the index of the first matching type, or something
        higher if no type matches.

        This provides an ordering in which service elements that
        contain a type that comes earlier in the preferred types list
        come before service elements that come later. If a service
        element has more than one type, the most preferred one wins.
        )rr�)rU�i�tr��preferred_typess   ��r$�bestMatchingServicez*arrangeByType.<locals>.bestMatchingServiceAsS����I�o�.�.�	�	�D�A�q��q�!�W�%6�6�6�����7��?�#�#�#r&c�2��g|]\}}�|��||f��Srnrn)�.0�
orig_index�sr�s   �r$�
<listcomp>z!arrangeByType.<locals>.<listcomp>RsE���E�E�E�(�*�a�*�)�!�,�,�j�!�<�E�E�Er&�)�sortr�r�)�service_listr��
prio_servicesr�r�r�s `  @@r$�
arrangeByTyper�6s������7�7�7�
$�
$�
$�
$�
$�
$�"E�E�E�E�,5�I�l�,C�,C�E�E�E�M��������3�}�%�%�
&�
&�/�/��(��+�A�.�
�a����r&c�j�t|tg��}t|tj��}|p|S)aExtract OP Identifier services.  If none found, return the
    rest, sorted with most preferred first according to
    OpenIDServiceEndpoint.openid_type_uris.

    openid_services is a list of OpenIDServiceEndpoint objects.

    Returns a list of OpenIDServiceEndpoint objects.)r�rrrE)�openid_services�op_servicess  r$�getOPOrUserServicesr�^s=�� ��2E�1F�G�G�K�#�O�$9�$J�L�L�O��)�/�)r&c�<�t|��}|j}|j}	t�||��}n#t
$rg}YnwxYw|s>|���rt|��St�||��}|t|��fS)aDDiscover OpenID services for a URI. Tries Yadis and falls back
    on old-style <link rel='...'> discovery if Yadis fails.

    @param uri: normalized identity URL
    @type uri: str

    @return: (claimed_id, services)
    @rtype: (str, list(OpenIDServiceEndpoint))

    @raises DiscoveryFailure: when discovery fails.
    )
�
yadisDiscoverr]r^rrZrr\�discoverNoYadisrVr�)r>�responser=�bodyr�s     r$�
discoverYadisr�os��� �S�!�!�H��'�I��!�D��/�8�8��D�I�I�����������������J��?�?���	(�#�3�'�'�'�0�8�8��D�I�I���*�?�;�;�<�<s�;�A
�	A
c��g}t|��}	tj���|tj��\}}|�t
d|�����tjt��}|D]+}|�	|�
||�����,n-#t$r t�d|z��YnwxYw|D]}||_
||_||_�|t!|��fS)NzNo CanonicalID found for XRI zxrds error on )r�r�
ProxyResolver�queryrrErr�mkFilter�extend�getServiceEndpoints�logger�	exceptionrrr!r�)�iname�	endpointsrrQ�fltr?rGs       r$�discoverXRIr��s0���I�����E�3� &� 4� 6� 6� <� <��(�9�!;�!;���X����)���I�J�J�J���4�5�5��'�	N�	N�O����S�4�4�U�O�L�L�M�M�M�M�	N���3�3�3����)�E�1�2�2�2�2�2�3�����,�,�� +���)���&+��#�#��%�i�0�0�0�0s�BB#�#'C
�C
c���tj|��}|jdvrtd|j��|���|j}t
�||j��}||fS)N)����zCHTTP Response status from identity URL host is not 200. Got status )r�fetch�statusr�	final_urlrrVr�)r>�	http_resprr�s    r$r�r��sx����s�#�#�I���z�)�)���(�/�/�
3�4=�?�?�	?��$�J�+�4�4�Z�5>�^�E�E�O���&�&r&c��tj�|��}|dr#|dr|ddvrtdd���nd|z}t	|��}t|��\}}t	|��}||fS)Nr
�)�http�httpszURI scheme is not HTTP or HTTPSzhttp://)r4r5�urlparserr~r�)r>�parsedrr�s    r$�discoverURIr��s���
�\�
"�
"�3�
'�
'�F�
�a�y��V�A�Y���!�9�-�-�-�"�#D�d�K�K�K�.��#�o��
�s�
�
�C�"/��"4�"4��J���j�)�)�J���&�&r&c�n�tj|��dkrt|��St|��S)N�XRI)r�identifierSchemer�r�)�
identifiers r$r	r	�s4��
��J�'�'�5�0�0��:�&�&�&��:�&�&�&r&)2rl�__all__�urllib.parser4�logging�openidrrr
�openid.yadis.etxrdrrr�openid.yadis.servicesrrX�openid.yadis.discoverr	r�r�openid.yadisrrr�openid.consumerrrrrrr�openid.messagerr-rr,�	getLoggerrir��objectrr<r~r�r�r�r�r�r�r�rnr&r$�<module>r�s����	�	�	����������$�$�$�$�$�$�$�$�������;�;�;�;�;�;�;�;�;�;�@�@�@�@�@�@�;�;�;�;�;�;�2�2�2�2�2�2�(�(�(�(�(�(�(�(�������&�&�&�&�&�&�-�
�?��;��0��0��>�>�>�>�>�>�>�>�>�>�>�>�	��	�8�	$�	$��D;�D;�D;�D;�D;�F�D;�D;�D;�N/�/�/�d5�5�5����%�%�%�P*�*�*�"'=�'=�'=�T1�1�1�6
'�
'�
'�'�'�'�'�'�'�'�'r&

Youez - 2016 - github.com/yon3zu
LinuXploit