?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/openid.tar
???????
__pycache__/__init__.cpython-39.opt-1.pyc 0000644 00000000540 15125232510 0014076 0 ustar 00 a \��`� � @ s$ d Z ddlmZmZ ddlmZ dS )z! oauthlib.openid ~~~~~~~~~~~~~~ � )�Server�UserInfoEndpoint)�RequestValidatorN)�__doc__Zconnect.core.endpointsr r Zconnect.core.request_validatorr � r r �</usr/lib/python3.9/site-packages/oauthlib/openid/__init__.py�<module> s __pycache__/__init__.cpython-39.pyc 0000644 00000000540 15125232510 0013137 0 ustar 00 a \��`� � @ s$ d Z ddlmZmZ ddlmZ dS )z! oauthlib.openid ~~~~~~~~~~~~~~ � )�Server�UserInfoEndpoint)�RequestValidatorN)�__doc__Zconnect.core.endpointsr r Zconnect.core.request_validatorr � r r �</usr/lib/python3.9/site-packages/oauthlib/openid/__init__.py�<module> s connect/__pycache__/__init__.cpython-39.opt-1.pyc 0000644 00000000237 15125232510 0015532 0 ustar 00 a \��` � @ s d S )N� r r r �D/usr/lib/python3.9/site-packages/oauthlib/openid/connect/__init__.py�<module> � connect/__pycache__/__init__.cpython-39.pyc 0000644 00000000237 15125232510 0014573 0 ustar 00 a \��` � @ s d S )N� r r r �D/usr/lib/python3.9/site-packages/oauthlib/openid/connect/__init__.py�<module> � connect/core/exceptions.py 0000644 00000011266 15125232510 0011662 0 ustar 00 """ oauthlib.oauth2.rfc6749.errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error used both by OAuth 2 clients and providers to represent the spec defined error responses for all four core grant types. """ from oauthlib.oauth2.rfc6749.errors import FatalClientError, OAuth2Error class FatalOpenIDClientError(FatalClientError): pass class OpenIDClientError(OAuth2Error): pass class InteractionRequired(OpenIDClientError): """ The Authorization Server requires End-User interaction to proceed. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User interaction. """ error = 'interaction_required' status_code = 401 class LoginRequired(OpenIDClientError): """ The Authorization Server requires End-User authentication. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication. """ error = 'login_required' status_code = 401 class AccountSelectionRequired(OpenIDClientError): """ The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface to prompt for a session to use. """ error = 'account_selection_required' class ConsentRequired(OpenIDClientError): """ The Authorization Server requires End-User consent. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User consent. """ error = 'consent_required' status_code = 401 class InvalidRequestURI(OpenIDClientError): """ The request_uri in the Authorization Request returns an error or contains invalid data. """ error = 'invalid_request_uri' description = 'The request_uri in the Authorization Request returns an ' \ 'error or contains invalid data.' class InvalidRequestObject(OpenIDClientError): """ The request parameter contains an invalid Request Object. """ error = 'invalid_request_object' description = 'The request parameter contains an invalid Request Object.' class RequestNotSupported(OpenIDClientError): """ The OP does not support use of the request parameter. """ error = 'request_not_supported' description = 'The request parameter is not supported.' class RequestURINotSupported(OpenIDClientError): """ The OP does not support use of the request_uri parameter. """ error = 'request_uri_not_supported' description = 'The request_uri parameter is not supported.' class RegistrationNotSupported(OpenIDClientError): """ The OP does not support use of the registration parameter. """ error = 'registration_not_supported' description = 'The registration parameter is not supported.' class InvalidTokenError(OAuth2Error): """ The access token provided is expired, revoked, malformed, or invalid for other reasons. The resource SHOULD respond with the HTTP 401 (Unauthorized) status code. The client MAY request a new access token and retry the protected resource request. """ error = 'invalid_token' status_code = 401 description = ("The access token provided is expired, revoked, malformed, " "or invalid for other reasons.") class InsufficientScopeError(OAuth2Error): """ The request requires higher privileges than provided by the access token. The resource server SHOULD respond with the HTTP 403 (Forbidden) status code and MAY include the "scope" attribute with the scope necessary to access the protected resource. """ error = 'insufficient_scope' status_code = 403 description = ("The request requires higher privileges than provided by " "the access token.") def raise_from_error(error, params=None): import inspect import sys kwargs = { 'description': params.get('error_description'), 'uri': params.get('error_uri'), 'state': params.get('state') } for _, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass): if cls.error == error: raise cls(**kwargs) connect/core/__pycache__/request_validator.cpython-39.opt-1.pyc 0000644 00000033562 15125232510 0020467 0 ustar 00 a \��`�4 � @ s6 d Z ddlZddlmZ e�e�ZG dd� de�ZdS )z_ oauthlib.openid.connect.core.request_validator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ � N)�RequestValidatorc @ sd e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dS )r c C s t d��dS )az Extracts scopes from saved authorization code. The scopes returned by this method is used to route token requests based on scopes passed to Authorization Code requests. With that the token endpoint knows when to include OpenIDConnect id_token in token response only based on authorization code scopes. Only code param should be sufficient to retrieve grant code from any storage you are using, `client_id` and `redirect_uri` can have a blank value `""` don't forget to check it before using those values in a select query if a database is used. :param client_id: Unicode client identifier :param code: Unicode authorization code grant :param redirect_uri: Unicode absolute URI :return: A list of scope Method is used by: - Authorization Token Grant Dispatcher �&Subclasses must implement this method.N��NotImplementedError��selfZ client_id�codeZredirect_uri�request� r �R/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/request_validator.py�get_authorization_code_scopes s z.RequestValidator.get_authorization_code_scopesc C s t d��dS )ao Extracts nonce from saved authorization code. If present in the Authentication Request, Authorization Servers MUST include a nonce Claim in the ID Token with the Claim Value being the nonce value sent in the Authentication Request. Authorization Servers SHOULD perform no other processing on nonce values used. The nonce value is a case-sensitive string. Only code param should be sufficient to retrieve grant code from any storage you are using. However, `client_id` and `redirect_uri` have been validated and can be used also. :param client_id: Unicode client identifier :param code: Unicode authorization code grant :param redirect_uri: Unicode absolute URI :return: Unicode nonce Method is used by: - Authorization Token Grant Dispatcher r Nr r r r r �get_authorization_code_nonce( s z-RequestValidator.get_authorization_code_noncec C s t d��dS )a Get JWT Bearer token or OpenID Connect ID token If using OpenID Connect this SHOULD call `oauthlib.oauth2.RequestValidator.get_id_token` :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The JWT Bearer token or OpenID Connect ID token (a JWS signed JWT) Method is used by JWT Bearer and OpenID Connect tokens: - JWTToken.create_token r Nr �r �token� token_handlerr r r r �get_jwt_bearer_token@ s z%RequestValidator.get_jwt_bearer_tokenc C s dS )a8 Get OpenID Connect ID token This method is OPTIONAL and is NOT RECOMMENDED. `finalize_id_token` SHOULD be implemented instead. However, if you want a full control over the minting of the `id_token`, you MAY want to override `get_id_token` instead of using `finalize_id_token`. In the OpenID Connect workflows when an ID Token is requested this method is called. Subclasses should implement the construction, signing and optional encryption of the ID Token as described in the OpenID Connect spec. In addition to the standard OAuth2 request properties, the request may also contain these OIDC specific properties which are useful to this method: - nonce, if workflow is implicit or hybrid and it was provided - claims, if provided to the original Authorization Code request The token parameter is a dict which may contain an ``access_token`` entry, in which case the resulting ID Token *should* include a calculated ``at_hash`` claim. Similarly, when the request parameter has a ``code`` property defined, the ID Token *should* include a calculated ``c_hash`` claim. http://openid.net/specs/openid-connect-core-1_0.html (sections `3.1.3.6`_, `3.2.2.10`_, `3.3.2.11`_) .. _`3.1.3.6`: http://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken .. _`3.2.2.10`: http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDToken .. _`3.3.2.11`: http://openid.net/specs/openid-connect-core-1_0.html#HybridIDToken :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The ID Token (a JWS signed JWT) Nr r r r r �get_id_tokenP s %zRequestValidator.get_id_tokenc C s t d��dS )a� Finalize OpenID Connect ID token & Sign or Encrypt. In the OpenID Connect workflows when an ID Token is requested this method is called. Subclasses should implement the construction, signing and optional encryption of the ID Token as described in the OpenID Connect spec. The `id_token` parameter is a dict containing a couple of OIDC technical fields related to the specification. Prepopulated attributes are: - `aud`, equals to `request.client_id`. - `iat`, equals to current time. - `nonce`, if present, is equals to the `nonce` from the authorization request. - `at_hash`, hash of `access_token`, if relevant. - `c_hash`, hash of `code`, if relevant. This method MUST provide required fields as below: - `iss`, REQUIRED. Issuer Identifier for the Issuer of the response. - `sub`, REQUIRED. Subject Identifier - `exp`, REQUIRED. Expiration time on or after which the ID Token MUST NOT be accepted by the RP when performing authentication with the OP. Additionals claims must be added, note that `request.scope` should be used to determine the list of claims. More information can be found at `OpenID Connect Core#Claims`_ .. _`OpenID Connect Core#Claims`: https://openid.net/specs/openid-connect-core-1_0.html#Claims :param id_token: A dict containing technical fields of id_token :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The ID Token (a JWS signed JWT or JWE encrypted JWT) r Nr )r Zid_tokenr r r r r r �finalize_id_tokenw s )z"RequestValidator.finalize_id_tokenc C s t d��dS )ag Ensure the JWT Bearer token or OpenID Connect ID token are valids and authorized access to scopes. If using OpenID Connect this SHOULD call `oauthlib.oauth2.RequestValidator.get_id_token` If not using OpenID Connect this can `return None` to avoid 5xx rather 401/3 response. OpenID connect core 1.0 describe how to validate an id_token: - http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation - http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation2 :param token: Unicode Bearer token :param scopes: List of scopes (defined by you) :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is indirectly used by all core OpenID connect JWT token issuing grant types: - Authorization Code Grant - Implicit Grant - Hybrid Grant r Nr �r r �scopesr r r r �validate_jwt_bearer_token� s z*RequestValidator.validate_jwt_bearer_tokenc C s t d��dS )a� Ensure the id token is valid and authorized access to scopes. OpenID connect core 1.0 describe how to validate an id_token: - http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation - http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation2 :param token: Unicode Bearer token :param scopes: List of scopes (defined by you) :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is indirectly used by all core OpenID connect JWT token issuing grant types: - Authorization Code Grant - Implicit Grant - Hybrid Grant r Nr r r r r �validate_id_token� s z"RequestValidator.validate_id_tokenc C s t d��dS )a� Ensure the logged in user has authorized silent OpenID authorization. Silent OpenID authorization allows access tokens and id tokens to be granted to clients without any user prompt or interaction. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr �r r r r r �validate_silent_authorization� s z.RequestValidator.validate_silent_authorizationc C s t d��dS )a� Ensure session user has authorized silent OpenID login. If no user is logged in or has not authorized silent login, this method should return False. If the user is logged in but associated with multiple accounts and not selected which one to link to the token then this method should raise an oauthlib.oauth2.AccountSelectionRequired error. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr r r r r �validate_silent_login� s z&RequestValidator.validate_silent_loginc C s t d��dS )ab Ensure client supplied user id hint matches session user. If the sub claim or id_token_hint is supplied then the session user must match the given ID. :param id_token_hint: User identifier string. :param scopes: List of OAuth 2 scopes and OpenID claims (strings). :param claims: OpenID Connect claims dict. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr )r Z id_token_hintr Zclaimsr r r r �validate_user_match� s z$RequestValidator.validate_user_matchc C s dS )aM Return the UserInfo claims in JSON or Signed or Encrypted. The UserInfo Claims MUST be returned as the members of a JSON object unless a signed or encrypted response was requested during Client Registration. The Claims defined in Section 5.1 can be returned, as can additional Claims not specified there. For privacy reasons, OpenID Providers MAY elect to not return values for some requested Claims. If a Claim is not returned, that Claim Name SHOULD be omitted from the JSON object representing the Claims; it SHOULD NOT be present with a null or empty string value. The sub (subject) Claim MUST always be returned in the UserInfo Response. Upon receipt of the UserInfo Request, the UserInfo Endpoint MUST return the JSON Serialization of the UserInfo Response as in Section 13.3 in the HTTP response body unless a different format was specified during Registration [OpenID.Registration]. If the UserInfo Response is signed and/or encrypted, then the Claims are returned in a JWT and the content-type MUST be application/jwt. The response MAY be encrypted without also being signed. If both signing and encryption are requested, the response MUST be signed then encrypted, with the result being a Nested JWT, as defined in [JWT]. If signed, the UserInfo Response SHOULD contain the Claims iss (issuer) and aud (audience) as members. The iss value SHOULD be the OP's Issuer Identifier URL. The aud value SHOULD be or include the RP's Client ID value. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: Claims as a dict OR JWT/JWS/JWE as a string Method is used by: UserInfoEndpoint Nr r r r r �get_userinfo_claims s z$RequestValidator.get_userinfo_claimsN)�__name__� __module__�__qualname__r r r r r r r r r r r r r r r r s '+r )�__doc__ZloggingZ)oauthlib.oauth2.rfc6749.request_validatorr ZOAuth2RequestValidatorZ getLoggerr �logr r r r �<module> s connect/core/__pycache__/__init__.cpython-39.opt-1.pyc 0000644 00000000244 15125232510 0016460 0 ustar 00 a \��` � @ s d S )N� r r r �I/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/__init__.py�<module> � connect/core/__pycache__/request_validator.cpython-39.pyc 0000644 00000033562 15125232510 0017530 0 ustar 00 a \��`�4 � @ s6 d Z ddlZddlmZ e�e�ZG dd� de�ZdS )z_ oauthlib.openid.connect.core.request_validator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ � N)�RequestValidatorc @ sd e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dS )r c C s t d��dS )az Extracts scopes from saved authorization code. The scopes returned by this method is used to route token requests based on scopes passed to Authorization Code requests. With that the token endpoint knows when to include OpenIDConnect id_token in token response only based on authorization code scopes. Only code param should be sufficient to retrieve grant code from any storage you are using, `client_id` and `redirect_uri` can have a blank value `""` don't forget to check it before using those values in a select query if a database is used. :param client_id: Unicode client identifier :param code: Unicode authorization code grant :param redirect_uri: Unicode absolute URI :return: A list of scope Method is used by: - Authorization Token Grant Dispatcher �&Subclasses must implement this method.N��NotImplementedError��selfZ client_id�codeZredirect_uri�request� r �R/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/request_validator.py�get_authorization_code_scopes s z.RequestValidator.get_authorization_code_scopesc C s t d��dS )ao Extracts nonce from saved authorization code. If present in the Authentication Request, Authorization Servers MUST include a nonce Claim in the ID Token with the Claim Value being the nonce value sent in the Authentication Request. Authorization Servers SHOULD perform no other processing on nonce values used. The nonce value is a case-sensitive string. Only code param should be sufficient to retrieve grant code from any storage you are using. However, `client_id` and `redirect_uri` have been validated and can be used also. :param client_id: Unicode client identifier :param code: Unicode authorization code grant :param redirect_uri: Unicode absolute URI :return: Unicode nonce Method is used by: - Authorization Token Grant Dispatcher r Nr r r r r �get_authorization_code_nonce( s z-RequestValidator.get_authorization_code_noncec C s t d��dS )a Get JWT Bearer token or OpenID Connect ID token If using OpenID Connect this SHOULD call `oauthlib.oauth2.RequestValidator.get_id_token` :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The JWT Bearer token or OpenID Connect ID token (a JWS signed JWT) Method is used by JWT Bearer and OpenID Connect tokens: - JWTToken.create_token r Nr �r �token� token_handlerr r r r �get_jwt_bearer_token@ s z%RequestValidator.get_jwt_bearer_tokenc C s dS )a8 Get OpenID Connect ID token This method is OPTIONAL and is NOT RECOMMENDED. `finalize_id_token` SHOULD be implemented instead. However, if you want a full control over the minting of the `id_token`, you MAY want to override `get_id_token` instead of using `finalize_id_token`. In the OpenID Connect workflows when an ID Token is requested this method is called. Subclasses should implement the construction, signing and optional encryption of the ID Token as described in the OpenID Connect spec. In addition to the standard OAuth2 request properties, the request may also contain these OIDC specific properties which are useful to this method: - nonce, if workflow is implicit or hybrid and it was provided - claims, if provided to the original Authorization Code request The token parameter is a dict which may contain an ``access_token`` entry, in which case the resulting ID Token *should* include a calculated ``at_hash`` claim. Similarly, when the request parameter has a ``code`` property defined, the ID Token *should* include a calculated ``c_hash`` claim. http://openid.net/specs/openid-connect-core-1_0.html (sections `3.1.3.6`_, `3.2.2.10`_, `3.3.2.11`_) .. _`3.1.3.6`: http://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken .. _`3.2.2.10`: http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDToken .. _`3.3.2.11`: http://openid.net/specs/openid-connect-core-1_0.html#HybridIDToken :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The ID Token (a JWS signed JWT) Nr r r r r �get_id_tokenP s %zRequestValidator.get_id_tokenc C s t d��dS )a� Finalize OpenID Connect ID token & Sign or Encrypt. In the OpenID Connect workflows when an ID Token is requested this method is called. Subclasses should implement the construction, signing and optional encryption of the ID Token as described in the OpenID Connect spec. The `id_token` parameter is a dict containing a couple of OIDC technical fields related to the specification. Prepopulated attributes are: - `aud`, equals to `request.client_id`. - `iat`, equals to current time. - `nonce`, if present, is equals to the `nonce` from the authorization request. - `at_hash`, hash of `access_token`, if relevant. - `c_hash`, hash of `code`, if relevant. This method MUST provide required fields as below: - `iss`, REQUIRED. Issuer Identifier for the Issuer of the response. - `sub`, REQUIRED. Subject Identifier - `exp`, REQUIRED. Expiration time on or after which the ID Token MUST NOT be accepted by the RP when performing authentication with the OP. Additionals claims must be added, note that `request.scope` should be used to determine the list of claims. More information can be found at `OpenID Connect Core#Claims`_ .. _`OpenID Connect Core#Claims`: https://openid.net/specs/openid-connect-core-1_0.html#Claims :param id_token: A dict containing technical fields of id_token :param token: A Bearer token dict :param token_handler: the token handler (BearerToken class) :param request: OAuthlib request. :type request: oauthlib.common.Request :return: The ID Token (a JWS signed JWT or JWE encrypted JWT) r Nr )r Zid_tokenr r r r r r �finalize_id_tokenw s )z"RequestValidator.finalize_id_tokenc C s t d��dS )ag Ensure the JWT Bearer token or OpenID Connect ID token are valids and authorized access to scopes. If using OpenID Connect this SHOULD call `oauthlib.oauth2.RequestValidator.get_id_token` If not using OpenID Connect this can `return None` to avoid 5xx rather 401/3 response. OpenID connect core 1.0 describe how to validate an id_token: - http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation - http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation2 :param token: Unicode Bearer token :param scopes: List of scopes (defined by you) :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is indirectly used by all core OpenID connect JWT token issuing grant types: - Authorization Code Grant - Implicit Grant - Hybrid Grant r Nr �r r �scopesr r r r �validate_jwt_bearer_token� s z*RequestValidator.validate_jwt_bearer_tokenc C s t d��dS )a� Ensure the id token is valid and authorized access to scopes. OpenID connect core 1.0 describe how to validate an id_token: - http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation - http://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation - http://openid.net/specs/openid-connect-core-1_0.html#HybridIDTValidation2 :param token: Unicode Bearer token :param scopes: List of scopes (defined by you) :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is indirectly used by all core OpenID connect JWT token issuing grant types: - Authorization Code Grant - Implicit Grant - Hybrid Grant r Nr r r r r �validate_id_token� s z"RequestValidator.validate_id_tokenc C s t d��dS )a� Ensure the logged in user has authorized silent OpenID authorization. Silent OpenID authorization allows access tokens and id tokens to be granted to clients without any user prompt or interaction. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr �r r r r r �validate_silent_authorization� s z.RequestValidator.validate_silent_authorizationc C s t d��dS )a� Ensure session user has authorized silent OpenID login. If no user is logged in or has not authorized silent login, this method should return False. If the user is logged in but associated with multiple accounts and not selected which one to link to the token then this method should raise an oauthlib.oauth2.AccountSelectionRequired error. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr r r r r �validate_silent_login� s z&RequestValidator.validate_silent_loginc C s t d��dS )ab Ensure client supplied user id hint matches session user. If the sub claim or id_token_hint is supplied then the session user must match the given ID. :param id_token_hint: User identifier string. :param scopes: List of OAuth 2 scopes and OpenID claims (strings). :param claims: OpenID Connect claims dict. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: True or False Method is used by: - OpenIDConnectAuthCode - OpenIDConnectImplicit - OpenIDConnectHybrid r Nr )r Z id_token_hintr Zclaimsr r r r �validate_user_match� s z$RequestValidator.validate_user_matchc C s dS )aM Return the UserInfo claims in JSON or Signed or Encrypted. The UserInfo Claims MUST be returned as the members of a JSON object unless a signed or encrypted response was requested during Client Registration. The Claims defined in Section 5.1 can be returned, as can additional Claims not specified there. For privacy reasons, OpenID Providers MAY elect to not return values for some requested Claims. If a Claim is not returned, that Claim Name SHOULD be omitted from the JSON object representing the Claims; it SHOULD NOT be present with a null or empty string value. The sub (subject) Claim MUST always be returned in the UserInfo Response. Upon receipt of the UserInfo Request, the UserInfo Endpoint MUST return the JSON Serialization of the UserInfo Response as in Section 13.3 in the HTTP response body unless a different format was specified during Registration [OpenID.Registration]. If the UserInfo Response is signed and/or encrypted, then the Claims are returned in a JWT and the content-type MUST be application/jwt. The response MAY be encrypted without also being signed. If both signing and encryption are requested, the response MUST be signed then encrypted, with the result being a Nested JWT, as defined in [JWT]. If signed, the UserInfo Response SHOULD contain the Claims iss (issuer) and aud (audience) as members. The iss value SHOULD be the OP's Issuer Identifier URL. The aud value SHOULD be or include the RP's Client ID value. :param request: OAuthlib request. :type request: oauthlib.common.Request :rtype: Claims as a dict OR JWT/JWS/JWE as a string Method is used by: UserInfoEndpoint Nr r r r r �get_userinfo_claims s z$RequestValidator.get_userinfo_claimsN)�__name__� __module__�__qualname__r r r r r r r r r r r r r r r r s '+r )�__doc__ZloggingZ)oauthlib.oauth2.rfc6749.request_validatorr ZOAuth2RequestValidatorZ getLoggerr �logr r r r �<module> s connect/core/__pycache__/tokens.cpython-39.opt-1.pyc 0000644 00000003177 15125232510 0016234 0 ustar 00 a \��`< � @ s, d Z ddlmZmZmZ G dd� de�ZdS )z� authlib.openid.connect.core.tokens ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains methods for adding JWT tokens to requests. � )� TokenBase�random_token_generator�get_token_from_headerc @ s4 e Zd ZdZddd�Zd dd�Zdd � Zd d� ZdS )�JWTToken)�request_validator�token_generator�refresh_token_generator� expires_inNc C s* || _ |pt| _|p| j| _|p"d| _d S )Ni )r r r r r )�selfr r r r � r �G/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/tokens.py�__init__ s �zJWTToken.__init__Fc C s2 t | j�r| �|�}n| j}||_| j�dd|�S )z2Create a JWT Token, using requestvalidator method.N)�callabler r Zget_jwt_bearer_token)r �requestZ refresh_tokenr r r r �create_token s zJWTToken.create_tokenc C s t |�}| j�||j|�S )N)r r Zvalidate_jwt_bearer_tokenZscopes�r r �tokenr r r �validate_request% s �zJWTToken.validate_requestc C s, t |�}|r(|�d�r(|�d�dv r(dS dS )NZey�.)� � � r )r � startswith�countr r r r � estimate_type* s zJWTToken.estimate_type)NNNN)F)�__name__� __module__�__qualname__� __slots__r r r r r r r r r s � r N)�__doc__Zoauthlib.oauth2.rfc6749.tokensr r r r r r r r �<module> s connect/core/__pycache__/exceptions.cpython-39.opt-1.pyc 0000644 00000013504 15125232510 0017105 0 ustar 00 a \��`� � @ s� d Z ddlmZmZ G dd� de�ZG dd� de�ZG dd� de�ZG d d � d e�ZG dd� de�ZG d d� de�Z G dd� de�Z G dd� de�ZG dd� de�ZG dd� de�Z G dd� de�ZG dd� de�ZG dd� de�Zd dd�ZdS )!z� oauthlib.oauth2.rfc6749.errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error used both by OAuth 2 clients and providers to represent the spec defined error responses for all four core grant types. � )�FatalClientError�OAuth2Errorc @ s e Zd ZdS )�FatalOpenIDClientErrorN��__name__� __module__�__qualname__� r r �K/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/exceptions.pyr s r c @ s e Zd ZdS )�OpenIDClientErrorNr r r r r r s r c @ s e Zd ZdZdZdZdS )�InteractionRequireda, The Authorization Server requires End-User interaction to proceed. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User interaction. Zinteraction_required� N�r r r �__doc__�error�status_coder r r r r s r c @ s e Zd ZdZdZdZdS )� LoginRequireda' The Authorization Server requires End-User authentication. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication. Zlogin_requiredr Nr r r r r r s r c @ s e Zd ZdZdZdS )�AccountSelectionRequireda� The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface to prompt for a session to use. Zaccount_selection_requiredN)r r r r r r r r r r + s r c @ s e Zd ZdZdZdZdS )�ConsentRequireda The Authorization Server requires End-User consent. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User consent. Zconsent_requiredr Nr r r r r r 9 s r c @ s e Zd ZdZdZdZdS )�InvalidRequestURIze The request_uri in the Authorization Request returns an error or contains invalid data. Zinvalid_request_urizWThe request_uri in the Authorization Request returns an error or contains invalid data.N�r r r r r �descriptionr r r r r E s r c @ s e Zd ZdZdZdZdS )�InvalidRequestObjectzC The request parameter contains an invalid Request Object. Zinvalid_request_objectz9The request parameter contains an invalid Request Object.Nr r r r r r O s r c @ s e Zd ZdZdZdZdS )�RequestNotSupportedz? The OP does not support use of the request parameter. Zrequest_not_supportedz'The request parameter is not supported.Nr r r r r r W s r c @ s e Zd ZdZdZdZdS )�RequestURINotSupportedzC The OP does not support use of the request_uri parameter. Zrequest_uri_not_supportedz+The request_uri parameter is not supported.Nr r r r r r _ s r c @ s e Zd ZdZdZdZdS )�RegistrationNotSupportedzD The OP does not support use of the registration parameter. Zregistration_not_supportedz,The registration parameter is not supported.Nr r r r r r g s r c @ s e Zd ZdZdZdZdZdS )�InvalidTokenErrora The access token provided is expired, revoked, malformed, or invalid for other reasons. The resource SHOULD respond with the HTTP 401 (Unauthorized) status code. The client MAY request a new access token and retry the protected resource request. Z invalid_tokenr zWThe access token provided is expired, revoked, malformed, or invalid for other reasons.N�r r r r r r r r r r r r o s r c @ s e Zd ZdZdZdZdZdS )�InsufficientScopeErrora The request requires higher privileges than provided by the access token. The resource server SHOULD respond with the HTTP 403 (Forbidden) status code and MAY include the "scope" attribute with the scope necessary to access the protected resource. Zinsufficient_scopei� zIThe request requires higher privileges than provided by the access token.Nr r r r r r } s r Nc C sh dd l }dd l}|�d�|�d�|�d�d�}|�|jt |j�D ] \}}|j| krB|f i |���qBd S )Nr Zerror_descriptionZ error_uri�state)r Zurir )�inspect�sys�getZ getmembers�modulesr Zisclassr )r �paramsr r! �kwargs�_�clsr r r �raise_from_error� s � r( )N)r Zoauthlib.oauth2.rfc6749.errorsr r r r r r r r r r r r r r r r( r r r r �<module> s connect/core/__pycache__/exceptions.cpython-39.pyc 0000644 00000013504 15125232510 0016146 0 ustar 00 a \��`� � @ s� d Z ddlmZmZ G dd� de�ZG dd� de�ZG dd� de�ZG d d � d e�ZG dd� de�ZG d d� de�Z G dd� de�Z G dd� de�ZG dd� de�ZG dd� de�Z G dd� de�ZG dd� de�ZG dd� de�Zd dd�ZdS )!z� oauthlib.oauth2.rfc6749.errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error used both by OAuth 2 clients and providers to represent the spec defined error responses for all four core grant types. � )�FatalClientError�OAuth2Errorc @ s e Zd ZdS )�FatalOpenIDClientErrorN��__name__� __module__�__qualname__� r r �K/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/exceptions.pyr s r c @ s e Zd ZdS )�OpenIDClientErrorNr r r r r r s r c @ s e Zd ZdZdZdZdS )�InteractionRequireda, The Authorization Server requires End-User interaction to proceed. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User interaction. Zinteraction_required� N�r r r �__doc__�error�status_coder r r r r s r c @ s e Zd ZdZdZdZdS )� LoginRequireda' The Authorization Server requires End-User authentication. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication. Zlogin_requiredr Nr r r r r r s r c @ s e Zd ZdZdZdS )�AccountSelectionRequireda� The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface to prompt for a session to use. Zaccount_selection_requiredN)r r r r r r r r r r + s r c @ s e Zd ZdZdZdZdS )�ConsentRequireda The Authorization Server requires End-User consent. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User consent. Zconsent_requiredr Nr r r r r r 9 s r c @ s e Zd ZdZdZdZdS )�InvalidRequestURIze The request_uri in the Authorization Request returns an error or contains invalid data. Zinvalid_request_urizWThe request_uri in the Authorization Request returns an error or contains invalid data.N�r r r r r �descriptionr r r r r E s r c @ s e Zd ZdZdZdZdS )�InvalidRequestObjectzC The request parameter contains an invalid Request Object. Zinvalid_request_objectz9The request parameter contains an invalid Request Object.Nr r r r r r O s r c @ s e Zd ZdZdZdZdS )�RequestNotSupportedz? The OP does not support use of the request parameter. Zrequest_not_supportedz'The request parameter is not supported.Nr r r r r r W s r c @ s e Zd ZdZdZdZdS )�RequestURINotSupportedzC The OP does not support use of the request_uri parameter. Zrequest_uri_not_supportedz+The request_uri parameter is not supported.Nr r r r r r _ s r c @ s e Zd ZdZdZdZdS )�RegistrationNotSupportedzD The OP does not support use of the registration parameter. Zregistration_not_supportedz,The registration parameter is not supported.Nr r r r r r g s r c @ s e Zd ZdZdZdZdZdS )�InvalidTokenErrora The access token provided is expired, revoked, malformed, or invalid for other reasons. The resource SHOULD respond with the HTTP 401 (Unauthorized) status code. The client MAY request a new access token and retry the protected resource request. Z invalid_tokenr zWThe access token provided is expired, revoked, malformed, or invalid for other reasons.N�r r r r r r r r r r r r o s r c @ s e Zd ZdZdZdZdZdS )�InsufficientScopeErrora The request requires higher privileges than provided by the access token. The resource server SHOULD respond with the HTTP 403 (Forbidden) status code and MAY include the "scope" attribute with the scope necessary to access the protected resource. Zinsufficient_scopei� zIThe request requires higher privileges than provided by the access token.Nr r r r r r } s r Nc C sh dd l }dd l}|�d�|�d�|�d�d�}|�|jt |j�D ] \}}|j| krB|f i |���qBd S )Nr Zerror_descriptionZ error_uri�state)r Zurir )�inspect�sys�getZ getmembers�modulesr Zisclassr )r �paramsr r! �kwargs�_�clsr r r �raise_from_error� s � r( )N)r Zoauthlib.oauth2.rfc6749.errorsr r r r r r r r r r r r r r r r( r r r r �<module> s connect/core/__pycache__/tokens.cpython-39.pyc 0000644 00000003177 15125232510 0015275 0 ustar 00 a \��`< � @ s, d Z ddlmZmZmZ G dd� de�ZdS )z� authlib.openid.connect.core.tokens ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains methods for adding JWT tokens to requests. � )� TokenBase�random_token_generator�get_token_from_headerc @ s4 e Zd ZdZddd�Zd dd�Zdd � Zd d� ZdS )�JWTToken)�request_validator�token_generator�refresh_token_generator� expires_inNc C s* || _ |pt| _|p| j| _|p"d| _d S )Ni )r r r r r )�selfr r r r � r �G/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/tokens.py�__init__ s �zJWTToken.__init__Fc C s2 t | j�r| �|�}n| j}||_| j�dd|�S )z2Create a JWT Token, using requestvalidator method.N)�callabler r Zget_jwt_bearer_token)r �requestZ refresh_tokenr r r r �create_token s zJWTToken.create_tokenc C s t |�}| j�||j|�S )N)r r Zvalidate_jwt_bearer_tokenZscopes�r r �tokenr r r �validate_request% s �zJWTToken.validate_requestc C s, t |�}|r(|�d�r(|�d�dv r(dS dS )NZey�.)� � � r )r � startswith�countr r r r � estimate_type* s zJWTToken.estimate_type)NNNN)F)�__name__� __module__�__qualname__� __slots__r r r r r r r r r s � r N)�__doc__Zoauthlib.oauth2.rfc6749.tokensr r r r r r r r �<module> s connect/core/__pycache__/__init__.cpython-39.pyc 0000644 00000000244 15125232510 0015521 0 ustar 00 a \��` � @ s d S )N� r r r �I/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/__init__.py�<module> � connect/core/endpoints/__pycache__/pre_configured.cpython-39.pyc 0000644 00000006740 15125232510 0020767 0 ustar 00 a \��`2 � @ s� d Z ddlmZmZmZmZmZ ddlmZ m Z mZm Z mZ ddlmZ ddlmZmZmZ ddlmZmZmZ ddlmZ d d lmZ G dd� deeeeee�Zd S )z� oauthlib.openid.connect.core.endpoints.pre_configured ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various endpoints needed for providing OpenID Connect servers. � )�AuthorizationEndpoint�IntrospectEndpoint�ResourceEndpoint�RevocationEndpoint� TokenEndpoint)�AuthorizationCodeGrant�ClientCredentialsGrant� ImplicitGrant�RefreshTokenGrant�%ResourceOwnerPasswordCredentialsGrant)�BearerToken� )r �HybridGrantr )� AuthorizationCodeGrantDispatcher�!AuthorizationTokenGrantDispatcher�ImplicitTokenGrantDispatcher)�JWTToken� )�UserInfoEndpointc @ s e Zd ZdZddd�ZdS )�Serverz<An all-in-one endpoint featuring all four major grant types.Nc O sF t |�| _t|�| _t|�| _t|�| _t|�| _ t |�| _t|�| _ t|�| _t||||�| _t||||�| _t| j| jd�| _t| j| j d�| _tj| d| j| j| j | j | j| j| j| jd�| jd� t|| j| jd�| _tj| d| j| j| j| j d�| jd� tj| d| j| jd �d � t�| |� t�| |� t �| |� dS )a� Construct a new all-grants-in-one server. :param request_validator: An implementation of oauthlib.oauth2.RequestValidator. :param token_expires_in: An int or a function to generate a token expiration offset (in seconds) given a oauthlib.common.Request object. :param token_generator: A function to generate a token from a request. :param refresh_token_generator: A function to generate a token from a request for the refresh token. :param kwargs: Extra parameters to pass to authorization-, token-, resource-, and revocation-endpoint constructors. )Z default_grantZ oidc_grant�code)r �tokenZid_tokenzid_token tokenz code tokenz code id_tokenzcode id_token tokenZnone)Zdefault_response_typeZresponse_types�default_token_type�authorization_code)r �passwordZclient_credentialsZ refresh_token)Zdefault_grant_type�grant_typesr �Bearer)r ZJWT)Z default_tokenZtoken_typesN)!�OAuth2AuthorizationCodeGrantZ auth_grant�OAuth2ImplicitGrantZimplicit_grantr Zpassword_grantr Zcredentials_grantr Z refresh_grantr Zopenid_connect_authr Zopenid_connect_implicitr Zopenid_connect_hybridr Zbearerr Zjwtr Zauth_grant_choicer Zimplicit_grant_choicer �__init__r Ztoken_grant_choicer r r r r )�selfZrequest_validatorZtoken_expires_inZtoken_generatorZrefresh_token_generator�args�kwargs� r# �Y/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/endpoints/pre_configured.pyr ! sZ � ��� � ���zServer.__init__)NNN)�__name__� __module__�__qualname__�__doc__r r# r# r# r$ r s �r N)r( Z!oauthlib.oauth2.rfc6749.endpointsr r r r r Z#oauthlib.oauth2.rfc6749.grant_typesr r r r r r r Zoauthlib.oauth2.rfc6749.tokensr r r Zgrant_types.dispatchersr r r �tokensr �userinfor r r# r# r# r$ �<module> s � connect/core/endpoints/__pycache__/__init__.cpython-39.opt-1.pyc 0000644 00000000661 15125232510 0020466 0 ustar 00 a \��`� � @ s d Z ddlmZ ddlmZ dS )z� oauthlib.oopenid.core ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming and providing OpenID Connect � )�Server)�UserInfoEndpointN)�__doc__Zpre_configuredr �userinfor � r r �S/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/endpoints/__init__.py�<module> s connect/core/endpoints/__pycache__/pre_configured.cpython-39.opt-1.pyc 0000644 00000006740 15125232510 0021726 0 ustar 00 a \��`2 � @ s� d Z ddlmZmZmZmZmZ ddlmZ m Z mZm Z mZ ddlmZ ddlmZmZmZ ddlmZmZmZ ddlmZ d d lmZ G dd� deeeeee�Zd S )z� oauthlib.openid.connect.core.endpoints.pre_configured ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various endpoints needed for providing OpenID Connect servers. � )�AuthorizationEndpoint�IntrospectEndpoint�ResourceEndpoint�RevocationEndpoint� TokenEndpoint)�AuthorizationCodeGrant�ClientCredentialsGrant� ImplicitGrant�RefreshTokenGrant�%ResourceOwnerPasswordCredentialsGrant)�BearerToken� )r �HybridGrantr )� AuthorizationCodeGrantDispatcher�!AuthorizationTokenGrantDispatcher�ImplicitTokenGrantDispatcher)�JWTToken� )�UserInfoEndpointc @ s e Zd ZdZddd�ZdS )�Serverz<An all-in-one endpoint featuring all four major grant types.Nc O sF t |�| _t|�| _t|�| _t|�| _t|�| _ t |�| _t|�| _ t|�| _t||||�| _t||||�| _t| j| jd�| _t| j| j d�| _tj| d| j| j| j | j | j| j| j| jd�| jd� t|| j| jd�| _tj| d| j| j| j| j d�| jd� tj| d| j| jd �d � t�| |� t�| |� t �| |� dS )a� Construct a new all-grants-in-one server. :param request_validator: An implementation of oauthlib.oauth2.RequestValidator. :param token_expires_in: An int or a function to generate a token expiration offset (in seconds) given a oauthlib.common.Request object. :param token_generator: A function to generate a token from a request. :param refresh_token_generator: A function to generate a token from a request for the refresh token. :param kwargs: Extra parameters to pass to authorization-, token-, resource-, and revocation-endpoint constructors. )Z default_grantZ oidc_grant�code)r �tokenZid_tokenzid_token tokenz code tokenz code id_tokenzcode id_token tokenZnone)Zdefault_response_typeZresponse_types�default_token_type�authorization_code)r �passwordZclient_credentialsZ refresh_token)Zdefault_grant_type�grant_typesr �Bearer)r ZJWT)Z default_tokenZtoken_typesN)!�OAuth2AuthorizationCodeGrantZ auth_grant�OAuth2ImplicitGrantZimplicit_grantr Zpassword_grantr Zcredentials_grantr Z refresh_grantr Zopenid_connect_authr Zopenid_connect_implicitr Zopenid_connect_hybridr Zbearerr Zjwtr Zauth_grant_choicer Zimplicit_grant_choicer �__init__r Ztoken_grant_choicer r r r r )�selfZrequest_validatorZtoken_expires_inZtoken_generatorZrefresh_token_generator�args�kwargs� r# �Y/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/endpoints/pre_configured.pyr ! sZ � ��� � ���zServer.__init__)NNN)�__name__� __module__�__qualname__�__doc__r r# r# r# r$ r s �r N)r( Z!oauthlib.oauth2.rfc6749.endpointsr r r r r Z#oauthlib.oauth2.rfc6749.grant_typesr r r r r r r Zoauthlib.oauth2.rfc6749.tokensr r r Zgrant_types.dispatchersr r r �tokensr �userinfor r r# r# r# r$ �<module> s � connect/core/endpoints/__pycache__/userinfo.cpython-39.opt-1.pyc 0000644 00000007414 15125232510 0020564 0 ustar 00 a \��` � @ sf d Z ddlZddlZddlmZ ddlmZ ddlmZm Z ddl mZ e�e �ZG dd� 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. e Zd ZdZdd� Zed dd��Zdd � ZdS )�UserInfoEndpointz,Authorizes access to userinfo resource. c C s$ t |d d d �| _|| _t�| � d S )N)r �bearer�request_validatorr �__init__)�selfr � r �S/usr/lib/python3.9/site-packages/oauthlib/openid/connect/core/endpoints/userinfo.pyr s zUserInfoEndpoint.__init__�GETNc C s� t ||||�}dg|_| �|� | j�|�}|du rLt�d|� tjdd��t |t �r�ddi}d|vr~t�d |� tjdd��t�|�}n0t |t �r�dd i}|}nt�d|� tjdd��t�d|� ||d fS )ap Validate 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� )Zstatus_codezContent-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 Zget_userinfo_claims�log�errorr ZServerError� isinstance�dict�json�dumps�str�debug)r ZuriZhttp_method�bodyZheaders�requestZclaimsZresp_headersr r r �create_userinfo_response s, � �z)UserInfoEndpoint.create_userinfo_responsec C s* | j �|�st�� �d|jvr&t�� �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" r N)r Zvalidate_requestr ZInvalidTokenErrorr ZInsufficientScopeError)r r r r r r B s z*UserInfoEndpoint.validate_userinfo_request)r NN)�__name__� __module__�__qualname__�__doc__r r r r r r r r r s %r )r"