File manager - Edit - /usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/__pycache__/metadata.cpython-310.pyc
Back
o ���a) � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m Z ddlmZ dd l mZ dd lmZ e�e�ZG dd� de �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� )�AuthorizationEndpoint)�BaseEndpoint�catch_errors_and_unavailability)�IntrospectEndpoint)�RevocationEndpoint)� TokenEndpointc @ sb e Zd ZdZi dfdd�Ze ddd��Zdd d�Zdd � Zdd� Z dd� Z dd� Zdd� ZdS )�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 C sP t |t�sJ �|D ] }t |t�sJ �q t�| � || _|| _|| _| �� | _d S )N) � isinstance�dictr �__init__�raise_errors� endpoints�initial_claims�validate_metadata_server�claims)�selfr r r �endpoint� r �L/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/metadata.pyr ( s zMetadataEndpoint.__init__�GETNc C s ddd�}|t �| j�dfS )z!Create metadata response zapplication/json�*)zContent-TypezAccess-Control-Allow-Origin�� )�json�dumpsr )r �uri�http_method�body�headersr r r �create_metadata_response3 s �z)MetadataEndpoint.create_metadata_responseFc C s | j sd S ||vr|rtd�|���d S |rE|| �d�s'td�||| ���d|| v s9d|| v s9d|| v rCtd�||| ���d S |rZ|| �d�sXtd �||| ���d S |r�t|| t�smtd �||| ���|| D ]}t|t�s�td�||| |���qqd S d S )Nzkey {} is a mandatory metadata.�httpszkey {}: {} 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�format� startswithr �list�str)r �array�key�is_required�is_list�is_url� is_issuer�elemr r r �validate_metadata>