Current Dir: /snap/core22/2437/usr/lib/python3/dist-packages/oauthlib/openid/connect/core/endpoints/__pycache__/

[FILE] pre_configured.cpython-310.pyc [ edit | delete | rename ]
[FILE] userinfo.cpython-310.pyc [ edit | delete | rename ]
[FILE] __init__.cpython-310.pyc [ edit | delete | rename ]

Viewing: /snap/core22/2437/usr/lib/python3/dist-packages/oauthlib/openid/connect/core/endpoints/__pycache__/userinfo.cpython-310.pyc

o

���a�@sfdZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZe�e
�ZGdd�de�ZdS)	z�
oauthlib.openid.connect.core.endpoints.userinfo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of userinfo endpoint.
�N)�Request)�errors)�BaseEndpoint�catch_errors_and_unavailability)�BearerTokenc@s.eZdZdZdd�Zed
dd��Zdd	�ZdS)�UserInfoEndpointz,Authorizes access to userinfo resource.
    cCs$t|ddd�|_||_t�|�dS)N)r�bearer�request_validatorr�__init__)�selfr	�r�Q/usr/lib/python3/dist-packages/oauthlib/openid/connect/core/endpoints/userinfo.pyr
szUserInfoEndpoint.__init__�GETNcCs�t||||�}dg|_|�|�|j�|�}|dur&t�d|�tjdd��t	|t
�rEddi}d|vr?t�d	|�tjdd��t�|�}nt	|t
�rQdd
i}|}nt�d|�tjdd��t�d|�||d
fS)apValidate BearerToken and return userinfo from RequestValidator

        The UserInfo Endpoint MUST return a
        content-type header to indicate which format is being returned. The
        content-type of the HTTP response MUST be application/json if the
        response body is a text JSON object; the response body SHOULD be encoded
        using UTF-8.
        �openidNz!Userinfo MUST have claims for %r.i�)�status_codezContent-Typezapplication/json�subz Userinfo MUST have "sub" for %r.zapplication/jwtz(Userinfo return unknown response for %r.zUserinfo access valid for %r.��)r�scopes�validate_userinfo_requestr	�get_userinfo_claims�log�errorr�ServerError�
isinstance�dict�json�dumps�str�debug)r�uri�http_method�body�headers�request�claims�resp_headersrrr
�create_userinfo_responses,


�
�
z)UserInfoEndpoint.create_userinfo_responsecCs*|j�|�s
t���d|jvrt���dS)a�Ensure the request is valid.

        5.3.1.  UserInfo Request
        The Client sends the UserInfo Request using either HTTP GET or HTTP
        POST. The Access Token obtained from an OpenID Connect Authentication
        Request MUST be sent as a Bearer Token, per Section 2 of OAuth 2.0
        Bearer Token Usage [RFC6750].

        It is RECOMMENDED that the request use the HTTP GET method and the
        Access Token be sent using the Authorization header field.

        The following is a non-normative example of a UserInfo Request:

        GET /userinfo HTTP/1.1
        Host: server.example.com
        Authorization: Bearer SlAV32hkKG

        5.3.3. UserInfo Error Response
        When an error condition occurs, the UserInfo Endpoint returns an Error
        Response as defined in Section 3 of OAuth 2.0 Bearer Token Usage
        [RFC6750]. (HTTP errors unrelated to RFC 6750 are returned to the User
        Agent using the appropriate HTTP status code.)

        The following is a non-normative example of a UserInfo Error Response:

        HTTP/1.1 401 Unauthorized
        WWW-Authenticate: Bearer error="invalid_token",
                error_description="The Access Token expired"
        rN)r�validate_requestr�InvalidTokenErrorr�InsufficientScopeError)rr#rrr
rBs

�z*UserInfoEndpoint.validate_userinfo_request)rNN)�__name__�
__module__�__qualname__�__doc__r
rr&rrrrr
rs%r)r-r�logging�oauthlib.commonr�oauthlib.oauth2.rfc6749r�&oauthlib.oauth2.rfc6749.endpoints.baserr�oauthlib.oauth2.rfc6749.tokensr�	getLoggerr*rrrrrr
�<module>s

Upload File: