� u��g���v�ddlZddlmZmZddlZddlmZddlmZeje ��Z d�Z d�Z d�Z d �ZdS) �N)�datetime� timedelta�)�Mex)�parse_responsec ��|std���|�!d|vr tj}nd|vr tj}|tjtjfvrtd|z���t |||||��}|j|f|d|d�d�|��}|jdkr t�d |j ��t|j ��S) Nz)WsTrust endpoint address can not be emptyz/trust/2005/usernamemixedz/trust/13/usernamemixedzZUnsupported soap action: %s. Contact your administrator to check your ADFS's MEX settings.z#application/soap+xml; charset=utf-8)z Content-type� SOAPAction)�data�headersi�z)Unsuccessful WsTrust request receives: %s) � ValueErrorr� ACTION_2005� ACTION_13� _build_rst�post� status_code�logger�debug�textr) �username�password�cloud_audience_urn�endpoint_address� soap_action� http_client�kwargsr �resps �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/msal/wstrust_request.py� send_requestr%s�� �F��D�E�E�E��� &�*:� :� :��/�K�K� &�*:� :� :��-�K��3�=�#�/�:�:�:��L�NY�Z�[�[� [� ��(�.�0@�+� O� O�D� �;� �,� �4�@�%�B�B� � �� � �D� ��3���� � �@�$�)�L�L�L� �$�)� $� $�$�c���|�dd���dd���dd���dd���d d ��S) N�&z&amp;�"z&quot;�'z&apos;�<z&lt;�>z&gt;)�replace)rs r�escape_passwordr'?sV�� � � �S�'� *� *� 2� 2�3�� A� A� ���h� � � ���f� � �g�g�c�6�2�2�4rc�,�|�d��S)Nz%Y-%m-%dT%H:%M:%SZ)�strftime)� datetime_objs r�wsu_time_formatr+Es�� � � �!5� 6� 6�6rc�&�tj��}d�tjdtjdtjd|t t j����|t|��t|td���z��|t|��|tj krtjdntjd||tj krd nd |tj krd nd � ��S)Na<s:Envelope xmlns:s='{s}' xmlns:wsa='{wsa}' xmlns:wsu='{wsu}'> <s:Header> <wsa:Action s:mustUnderstand='1'>{soap_action}</wsa:Action> <wsa:MessageID>urn:uuid:{message_id}</wsa:MessageID> <wsa:ReplyTo> <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> </wsa:ReplyTo> <wsa:To s:mustUnderstand='1'>{endpoint_address}</wsa:To> <wsse:Security s:mustUnderstand='1' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'> <wsu:Timestamp wsu:Id='_0'> <wsu:Created>{time_now}</wsu:Created> <wsu:Expires>{time_expire}</wsu:Expires> </wsu:Timestamp> <wsse:UsernameToken wsu:Id='ADALUsernameToken'> <wsse:Username>{username}</wsse:Username> <wsse:Password>{password}</wsse:Password> </wsse:UsernameToken> </wsse:Security> </s:Header> <s:Body> <wst:RequestSecurityToken xmlns:wst='{wst}'> <wsp:AppliesTo xmlns:wsp='http://schemas.xmlsoap.org/ws/2004/09/policy'> <wsa:EndpointReference> <wsa:Address>{applies_to}</wsa:Address> </wsa:EndpointReference> </wsp:AppliesTo> <wst:KeyType>{key_type}</wst:KeyType> <wst:RequestType>{request_type}</wst:RequestType> </wst:RequestSecurityToken> </s:Body> </s:Envelope>�s�wsu�wsa10� )�minutes�wst�wst2005z7http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearerz9http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKeyz6http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issuez1http://schemas.xmlsoap.org/ws/2005/02/trust/Issue)r-r.�wsar� message_idr�time_now� time_expirerrr2� applies_to�key_type� request_type) r�utcnow�formatr�NS�str�uuid�uuid4r+rr'r)rrrrr�nows rrrNs��� �/� � �C�! �B ���f�S�k�s�v�e�}�#�&��/�#��D�J�L�L�0A�0A�-�$�S�)�)�'��i��.C�.C�.C�(C�D�D����(A�(A�!,�� �!=�!=���u� � �3�6�)�CT�)��#�-�/�/�O�N�K��#�-�/�/�R�Q�C� � � �C0 r)r?rr�logging�mexr�wstrust_responser� getLogger�__name__rrr'r+r�rr�<module>rHs���8 � � � �(�(�(�(�(�(�(�(�����������,�,�,�,�,�,� �� �8� $� $��%�%�%�44�4�4� 7�7�7�2 �2 �2 �2 �2 r
Memory