HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/__pycache__/metadata.cpython-311.pyc
�

�c")���dZddlZddlZddlZddlmZmZddlmZddl	m
Z
mZddlm
Z
dd	lmZdd
lmZeje��ZGd�de
��ZdS)
z�
oauthlib.oauth2.rfc6749.endpoint.metadata
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

An implementation of the `OAuth 2.0 Authorization Server Metadata`.

.. _`OAuth 2.0 Authorization Server Metadata`: https://tools.ietf.org/html/rfc8414
�N�)�grant_types�utils�)�AuthorizationEndpoint)�BaseEndpoint�catch_errors_and_unavailability)�IntrospectEndpoint)�RevocationEndpoint)�
TokenEndpointc�`�eZdZdZidfd�Ze		dd���Zdd�Zd	�Zd
�Z	d�Z
d�Zd
�ZdS)�MetadataEndpointa�OAuth2.0 Authorization Server Metadata endpoint.

   This specification generalizes the metadata format defined by
   `OpenID Connect Discovery 1.0` in a way that is compatible
   with OpenID Connect Discovery while being applicable to a wider set
   of OAuth 2.0 use cases.  This is intentionally parallel to the way
   that OAuth 2.0 Dynamic Client Registration Protocol [`RFC7591`_]
   generalized the dynamic client registration mechanisms defined by
   OpenID Connect Dynamic Client Registration 1.0
   in a way that is compatible with it.

   .. _`OpenID Connect Discovery 1.0`: https://openid.net/specs/openid-connect-discovery-1_0.html
   .. _`RFC7591`: https://tools.ietf.org/html/rfc7591
   Tc���t|t��sJ�|D]}t|t��sJ��tj|��||_||_||_|���|_dS)N)	�
isinstance�dictr�__init__�raise_errors�	endpoints�initial_claims�validate_metadata_server�claims)�selfrrr�endpoints     �L/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/metadata.pyrzMetadataEndpoint.__init__(s���&�$�'�'�'�'�'�!�	6�	6�H��h��5�5�5�5�5�5���d�#�#�#�(���"���$����3�3�5�5������GETNc�D�ddd�}|tj|j��dfS)z!Create metadata response
        zapplication/json�*)zContent-TypezAccess-Control-Allow-Origin��)�json�dumpsr)r�uri�http_method�body�headerss     r�create_metadata_responsez)MetadataEndpoint.create_metadata_response3s1��/�+.�
�
����
�4�;�/�/��4�4rFc�<�|jsdS||vr&|r"td�|�����dS|r�tj||��s)td�|||�����d||vsd||vs
d||vr)td�|||�����dS|rF||�d��s)td�|||�����dS|r�t
||t��s)td	�|||�����||D]C}t
|t��s*td
�||||������BdSdS)Nzkey {} is a mandatory metadata.zkey {}: {} must be an HTTPS URL�?�&�#z8key {}: {} must not contain query or fragment components�httpzkey {}: {} must be an URLzkey {}: {} must be an Arrayz/array {}: {} must contains only string (not {}))	r�
ValueError�formatr�is_secure_transport�
startswithr�list�str)r�array�key�is_required�is_list�is_url�	is_issuer�elems        r�validate_metadataz"MetadataEndpoint.validate_metadata>s���� �	��F��e����
P� �!B�!I�!I�#�!N�!N�O�O�O�
P�
P��	v��,�U�3�Z�8�8�
\� �!B�!I�!I�#�u�UX�z�!Z�!Z�[�[�[��e�C�j� � �C�5��:�$5�$5���c�
�9J�9J� �![�!b�!b�cf�hm�nq�hr�!s�!s�t�t�t�:K�9J��		v���:�(�(��0�0�
V� �!<�!C�!C�C��s��!T�!T�U�U�U�
V�
V��	v��e�C�j�$�/�/�
X� �!>�!E�!E�c�5�QT�:�!V�!V�W�W�W��c�
�
v�
v��!�$��,�,�v�$�%V�%]�%]�^a�ch�il�cm�os�%t�%t�u�u�u�v�		v�	v�
v�
vrc�*�|j�|j�����|�dddg��|�|dd���|�|dd���|�|ddd���d	S)
z�
        If the token endpoint is used in the grant type, the value of this
        parameter MUST be the same as the value of the "grant_type"
        parameter passed to the token endpoint defined in the grant type
        definition.
        �%token_endpoint_auth_methods_supported�client_secret_post�client_secret_basicT�r5�0token_endpoint_auth_signing_alg_values_supported�token_endpoint�r4r6N)�_grant_types�extend�keys�
setdefaultr9�rrrs   r�validate_metadata_tokenz(MetadataEndpoint.validate_metadata_tokenWs���	
�� � ��!6�!;�!;�!=�!=�>�>�>����A�DX�Zo�Cp�q�q�q����v�'N�X\��]�]�]����v�'Y�cg��h�h�h����v�'7�T�RV��W�W�W�W�Wrc
���|�dttd�|j���������|�dddg��d|dvr|j�d��|�|ddd�	��|�|dd�
��d|dvr�|jd}t|tj
��st|d��r|j}|�d
t|j
�������|�|d
d�
��|�|ddd���dS)N�response_types_supportedc��|dkS)N�none�)�xs r�<lambda>zBMetadataEndpoint.validate_metadata_authorization.<locals>.<lambda>gs
���V��r�response_modes_supported�query�fragment�token�implicitT)r4r5r>�code�
default_grant� code_challenge_methods_supported�authorization_endpointrA)rEr0�filter�_response_typesrDrB�appendr9rr�AuthorizationCodeGrant�hasattrrU�_code_challenge_methods)rrr�
code_grants    r�validate_metadata_authorizationz0MetadataEndpoint.validate_metadata_authorizationes������4��v�&;�&;�X�=U�=Z�=Z�=\�=\�]�]�^�^�	`�	`�	`����4�w�
�6K�L�L�L�
�f�7�8�8�8���$�$�Z�0�0�0����v�'A�t�]a��b�b�b����v�'A�4��P�P�P��V�6�7�7�7�!�1�&�9�J��j�+�*L�M�M�
6�RY�Zd�fu�Rv�Rv�
6�'�5�
����@�"�:�#E�#J�#J�#L�#L�M�M�
O�
O�
O��"�"�6�+M�W[�"�\�\�\����v�'?�T�Z^��_�_�_�_�_rc���|�dddg��|�|dd���|�|dd���|�|ddd���dS)	N�*revocation_endpoint_auth_methods_supportedr<r=Tr>�5revocation_endpoint_auth_signing_alg_values_supported�revocation_endpointrA�rEr9rFs   r�validate_metadata_revocationz-MetadataEndpoint.validate_metadata_revocation|s������F�/�1F�G�	I�	I�	I�	
���v�'S�]a��b�b�b����v�'^�hl��m�m�m����v�'<�$�W[��\�\�\�\�\rc���|�dddg��|�|dd���|�|dd���|�|ddd���dS)	N�-introspection_endpoint_auth_methods_supportedr<r=Tr>�8introspection_endpoint_auth_signing_alg_values_supported�introspection_endpointrArdrFs   r�validate_metadata_introspectionz0MetadataEndpoint.validate_metadata_introspection�s������I�/�1F�G�	I�	I�	I�	
���v�'V�`d��e�e�e����v�'a�ko��p�p�p����v�'?�T�Z^��_�_�_�_�_rc�j�tj|j��}|�|ddd���|�|dd���|�|dd���|�|dd���|�|d	d���|�|d
d���|�|dd���g|_|jD]�}t
|t��r|�||��t
|t��r|�
||��t
|t��r|�||��t
|t��r|�||����|�d|j��|�|dd���|S)
a�	
        Authorization servers can have metadata describing their
        configuration.  The following authorization server metadata values
        are used by this specification. More details can be found in
        `RFC8414 section 2`_ :

       issuer
          REQUIRED

       authorization_endpoint
          URL of the authorization server's authorization endpoint
          [`RFC6749#Authorization`_].  This is REQUIRED unless no grant types are supported
          that use the authorization endpoint.

       token_endpoint
          URL of the authorization server's token endpoint [`RFC6749#Token`_].  This
          is REQUIRED unless only the implicit grant type is supported.

       scopes_supported
          RECOMMENDED.

       response_types_supported
          REQUIRED.

       Other OPTIONAL fields:
          jwks_uri,
          registration_endpoint,
          response_modes_supported

       grant_types_supported
          OPTIONAL.  JSON array containing a list of the OAuth 2.0 grant
          type values that this authorization server supports.  The array
          values used are the same as those used with the "grant_types"
          parameter defined by "OAuth 2.0 Dynamic Client Registration
          Protocol" [`RFC7591`_].  If omitted, the default value is
          "["authorization_code", "implicit"]".

       token_endpoint_auth_methods_supported

       token_endpoint_auth_signing_alg_values_supported

       service_documentation

       ui_locales_supported

       op_policy_uri

       op_tos_uri

       revocation_endpoint

       revocation_endpoint_auth_methods_supported

       revocation_endpoint_auth_signing_alg_values_supported

       introspection_endpoint

       introspection_endpoint_auth_methods_supported

       introspection_endpoint_auth_signing_alg_values_supported

       code_challenge_methods_supported

       Additional authorization server metadata parameters MAY also be used.
       Some are defined by other specifications, such as OpenID Connect
       Discovery 1.0 [`OpenID.Discovery`_].

        .. _`RFC8414 section 2`: https://tools.ietf.org/html/rfc8414#section-2
        .. _`RFC6749#Authorization`: https://tools.ietf.org/html/rfc6749#section-3.1
        .. _`RFC6749#Token`: https://tools.ietf.org/html/rfc6749#section-3.2
        .. _`RFC7591`: https://tools.ietf.org/html/rfc7591
        .. _`OpenID.Discovery`: https://openid.net/specs/openid-connect-discovery-1_0.html
        �issuerT)r4r7�jwks_uri)r6�scopes_supportedr>�service_documentation�ui_locales_supported�
op_policy_uri�
op_tos_uri�grant_types_supported)�copy�deepcopyrr9rBrrrrGrr_rrer
rjrErFs   rrz)MetadataEndpoint.validate_metadata_server�s���T��t�2�3�3�����v�x�T�T��R�R�R����v�z�$��?�?�?����v�'9�4��H�H�H����v�'>�t��L�L�L����v�'=�t��L�L�L����v��t��D�D�D����v�|�D��A�A�A������	G�	G�H��(�M�2�2�
?��,�,�V�X�>�>�>��(�$9�:�:�
G��4�4�V�X�F�F�F��(�$6�7�7�
D��1�1�&�(�C�C�C��(�$6�7�7�
G��4�4�V�X�F�F�F��	���1�4�3D�E�E�E����v�'>���M�M�M��
r)rNN)FFFF)
�__name__�
__module__�__qualname__�__doc__rr	r&r9rGr_rerjrrLrrrrs�������
�
�*,�$�	6�	6�	6�	6�%�DH�)-�5�5�5�%�$�5�v�v�v�v�2X�X�X�`�`�`�.]�]�]�`�`�`�b�b�b�b�brr)ryrtr �logging�rr�
authorizationr�baserr	�
introspectr
�
revocationrrRr�	getLoggerrv�logrrLrr�<module>r�s�����������������!�!�!�!�!�!�!�!�0�0�0�0�0�0�?�?�?�?�?�?�?�?�*�*�*�*�*�*�*�*�*�*�*�*� � � � � � ��g���!�!��W�W�W�W�W�|�W�W�W�W�Wr