� u��g7��� ddlmZn#e$r ddlmZYnwxYw ddlmZn#e$r ddlmZYnwxYwddlZeje ��Z d�Z d�Z Gd�de ��ZdS) �)�urlparse)� cElementTree)� ElementTreeNc�Z�d�|dgt|��dz zz��S)N�/z..�)�join�len)� route_to_leafs �X/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/msal/mex.py�_xpath_of_rootr )s-�� �8�8�M�T�F�c�-�.@�.@��.B�$C�C� D� D�D�c ��|j|fi|��}|��� t|j�����S#t j$r(t�d|j |j���wxYw)NzMalformed MEX document: %s, %s) �get�raise_for_status�Mex�text�&get_wstrust_username_password_endpoint�ET� ParseError�logger� exception� status_code)� mex_endpoint� http_client�kwargs�mex_resps r � send_requestr.s����{��|�6�6�v�6�6�H� ��������8�=�!�!�H�H�J�J�J�� �=������� ,�h�.B�H�M� S� S� S� ����s �%A � 7Bc�b�eZdZdddddddddd d d d d d �ZdZdZd�Zd�Zd�Zd�Z d�Z d�Z d�Z dS)rz http://schemas.xmlsoap.org/wsdl/z9http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702z4http://schemas.xmlsoap.org/ws/2005/07/securitypolicyzRhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsdz$http://www.w3.org/2005/08/addressingz3http://schemas.microsoft.com/ws/06/2004/policy/httpz'http://schemas.xmlsoap.org/wsdl/soap12/z,http://schemas.xmlsoap.org/ws/2004/09/policyz'http://www.w3.org/2003/05/soap-envelopez0http://docs.oasis-open.org/ws-sx/ws-trust/200512z%urn:oasis:names:tc:SAML:1.0:assertionz+http://schemas.xmlsoap.org/ws/2005/02/trust)�wsdl�sp�sp2005�wsu�wsa�wsa10�http�soap12�wsp�s�wst�trust�saml�wst2005z:http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issuez5http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issuec�8�tj|��|_dS)N)r� fromstring�dom)�self� mex_documents r �__init__z Mex.__init__Ns���=��.�.����rc�����d�jdz�t���fd��j�t |���j��D����S)Nz{%s}Idr#c���g|]E}|���j���d�|��������FS)Nz#{})�find�NS�formatr)�.0�policy� binding_xpath�id_attrr1s ���r � <listcomp>z'Mex._get_policy_ids.<locals>.<listcomp>SsV���@�@�@���{�{�=�$�'�2�2�>��L�L����G�!4�!4�5�5�?�>�>r)r7�setr0�findallr )r1�components_to_leafr;r<s` `@r �_get_policy_idszMex._get_policy_idsQs�������T�W�U�^�+���@�@�@�@�@�@��(�*�*�>�:L�+M�+M�t�w�W�W�@�@�@�A�A� Arc��gd�}|�|d��}gd�}|�|�|d����|S)N)� wsp:Policy�wsp:ExactlyOne�wsp:Allz"sp:SignedEncryptedSupportingTokensrCzsp:UsernameTokenrCzsp:WssUsernameToken10z.//sp:TransportBinding)rCrDrEzsp2005:SignedSupportingTokensrCzsp2005:UsernameTokenrCzsp2005:WssUsernameToken10�.//sp2005:TransportBinding)rA�update)r1�path�policies�path2005s r �!_get_username_password_policy_idsz%Mex._get_username_password_policy_idsXsl��G�G�G���'�'��.F�G�G��O�O�O�� ����,�,�X�7S�T�T�U�U�U��rc�2�|�gd�d��S)N)rCrDrEzhttp:NegotiateAuthenticationrF)rA)r1s r �_get_iwa_policy_idszMex._get_iwa_policy_idscs&���#�#� W� W� W� (�*�*� *rc��i}|j�d|j��D]�}|�d|j���d��dkr�5|�d|j���d��}|�d|j��D]0}|�d��|d �||�d ��<�1��|S) Nz wsdl:bindingzsoap12:binding� transportz$http://schemas.xmlsoap.org/soap/httpzwsdl:operation/soap12:operation� soapActionzwsp:PolicyReference�URI)� policy_uri�action�name)r0r?r7r6r)r1�bindings�bindingrS�prs r � _get_bindingszMex._get_bindingshs������x�'�'����@�@� C� C�G�� � �-�t�w�7�7�;�;�K�H�H�:�;�;���\�\�1�4�7�<�<�<?�C� �<M�<M� ��o�o�&;�T�W�E�E� C� C��"$�&�&��-�-�6�1C�1C�����V�,�,�-�-� C��rc���g}|j�d|j��D]�}|�d���d��d}|�|��}|rv|d|vrl|�d|j��}|�O|j����d��r#|� |j|dd �����|S) Nzwsdl:service/wsdl:portrV�:�����rRz%wsa10:EndpointReference/wsa10:Addresszhttps://rS)�addressrS) r0r?r7r�splitr6r�lower� startswith�append)r1rU� policy_ids� endpoints�port� binding_namerVr\s r �_get_endpointszMex._get_endpointsus���� ��H�$�$�%=�t�w�G�G� P� P�D��8�8�I�.�.�4�4�S�9�9�"�=�L��l�l�<�0�0�G�� P�7�<�0�J�>�>��)�)�$K�T�W�U�U���&�7�<�+=�+=�+?�+?�+J�+J�:�+V�+V�&��$�$�$+�L�G�H�<M�N�N�P�P�P���rc���|�|���|�����}|D]}|d|jkr|cS�|r|dndS)zDReturns {"address": "https://...", "action": "the soapAction value"}rSrN)rerXrK� ACTION_13)r1rb�es r rz*Mex.get_wstrust_username_password_endpoint�sw���'�'��"�"�$�$�d�&L�&L�&N�&N�P�P� �� � �A���{�d�n�,�,�����-�(�2�y��|�|�d�2rN) �__name__� __module__� __qualname__r7rg� ACTION_2005r3rArKrMrXrer�rr rr9s�������3�I�H�c�5�7�E�;�=� 6�A�C�7�@� � �B� M�I�I�K�/�/�/�A�A�A� � � �*�*�*� � � � � � �3�3�3�3�3rr)� urllib.parser� ImportError� xml.etreerrr�logging� getLoggerrirr r�objectrrmrr �<module>rts��8"�%�%�%�%�%�%�%���"�"�"�!�!�!�!�!�!�!�!�"����,�,�,�,�,�,�,�,���,�,�,�+�+�+�+�+�+�+�+�,�������� �� �8� $� $��E�E�E� ���O3�O3�O3�O3�O3�&�O3�O3�O3�O3�O3s� � ��"� 0�0
Memory