관리-도구
편집 파일: metadata.cpython-39.pyc
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 @ s^ e Zd ZdZi dfdd�Zeddd��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 �qt�| � || _|| _|| _| �� | _d S )N) � isinstance�dictr �__init__�raise_errors� endpoints�initial_claims�validate_metadata_server�claims)�selfr r r �endpoint� r �N/usr/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/endpoints/metadata.pyr ( s zMetadataEndpoint.__init__�GETNc C s ddi}|t �| j�dfS )z!Create metadata response zContent-Typezapplication/json�� )�json�dumpsr )r ZuriZhttp_method�bodyZheadersr r r �create_metadata_response3 s �z)MetadataEndpoint.create_metadata_responseFc C s | j s d S ||vr&|r$td�|���n�|r�|| �d�sLtd�||| ���d|| v spd|| v spd|| v r�td�||| ���n~|r�|| �d�s�td �||| ���nV|�rt|| t�s�td �||| ���|| D ]$}t|t�s�td�||| |���q�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 Zarray�key�is_required�is_list�is_url� is_issuer�elemr r r �validate_metadata= s&