
    )`i.                         d dl mZmZ d dlmZmZmZmZmZ  G d de          Z	 G d de
          Z G d de
          Z G d	 d
e          Z G d de          Z G d de          Z G d de          ZdS )    )AnyLiteral)
AnyHttpUrlAnyUrl	BaseModelFieldfield_validatorc                       e Zd ZU dZeed<   dZed         ed<   dZe	dz  ed<   dZ
edz  ed<   dZedz  ed<    edd	
          ededz  dedz  fd                        ZdS )
OAuthTokenzG
    See https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
    access_tokenBearer
token_typeN
expires_inscoperefresh_tokenbefore)modevreturnc                 X    t          |t                    r|                                S |S N)
isinstancestrtitle)clsr   s     c/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/mcp/shared/auth.pynormalize_token_typezOAuthToken.normalize_token_type   s+     a 	 7799    )__name__
__module____qualname____doc__r   __annotations__r   r   r   intr   r   r	   classmethodr    r   r   r   r      s           $,J!,,,!Jd
!!!E3: $M3:$$$_\111S4Z C$J    [ 21  r   r   c                       e Zd ZdefdZdS )InvalidScopeErrormessagec                     || _         d S r   r)   selfr)   s     r   __init__zInvalidScopeError.__init__       r   Nr   r    r!   r   r.   r&   r   r   r(   r(      /              r   r(   c                       e Zd ZdefdZdS )InvalidRedirectUriErrorr)   c                     || _         d S r   r+   r,   s     r   r.   z InvalidRedirectUriError.__init__!   r/   r   Nr0   r&   r   r   r3   r3       r1   r   r3   c                      e Zd ZU dZ edd          Zee         dz  ed<   dZ	e
d         dz  ed<   d	d
gZee
d         ez           ed<   dgZee         ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZee         dz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dedz  dee         dz  fdZdedz  defdZdS )OAuthClientMetadataz
    RFC 7591 OAuth 2.0 Dynamic Client Registration metadata.
    See https://datatracker.ietf.org/doc/html/rfc7591#section-2
    for the full specification.
    .   
min_lengthNredirect_uris)noneclient_secret_postclient_secret_basicprivate_key_jwttoken_endpoint_auth_methodauthorization_coder   )r@   r   z+urn:ietf:params:oauth:grant-type:jwt-bearergrant_typescoderesponse_typesr   client_name
client_urilogo_uricontactstos_uri
policy_urijwks_urijwkssoftware_idsoftware_versionrequested_scoper   c                     |d S |                     d          }| j        g n| j                             d          }|D ]}||vrt          d|           |S )N z%Client was not registered with scope )splitr   r(   )r-   rN   requested_scopesallowed_scopesr   s        r   validate_scopez"OAuthClientMetadata.validate_scopeJ   s    "4*0055#z1tz7G7G7L7L% 	Y 	YEN**'(WPU(W(WXXX +r   redirect_uric                     |%| j         	|| j         vrt          d| d          |S | j         %t          | j                   dk    r| j         d         S t          d          )NzRedirect URI 'z' not registered for clientr7   r   zGredirect_uri must be specified when client has multiple registered URIs)r:   r3   len)r-   rU   s     r   validate_redirect_uriz)OAuthClientMetadata.validate_redirect_uriT   sy    #!)\AS-S-S-.h|.h.h.hiii+D4F0G0G10L0L%a(()*stttr   )r   r    r!   r"   r   r:   listr   r#   r?   r   rA   r   rC   r   rD   rE   r   rF   rG   rH   rI   rJ   rK   r   rL   rM   rT   rX   r&   r   r   r6   r6   %   s          */sq)A)A)AM4<$&AAA 	 VWZ^^   		 dehkk    "(NDI(((E3: #Kt"""$(J
T!((("&Hj4&&&!%Hd3i$%%%!%GZ$%%%$(J
T!((("&Hj4&&&D#*"Kt"""#'cDj''' cDj  T#Y=M        	u&4- 	uF 	u 	u 	u 	u 	u 	ur   r6   c                   d    e Zd ZU dZdZedz  ed<   dZedz  ed<   dZe	dz  ed<   dZ
e	dz  ed<   dS )OAuthClientInformationFullzn
    RFC 7591 OAuth 2.0 Dynamic Client Registration full response
    (client information plus metadata).
    N	client_idclient_secretclient_id_issued_atclient_secret_expires_at)r   r    r!   r"   r\   r   r#   r]   r^   r$   r_   r&   r   r   r[   r[   `   sp          
 !IsTz    $M3:$$$&*t***+/cDj/////r   r[   c                   :   e Zd ZU dZeed<   eed<   eed<   dZedz  ed<   dZee	         dz  ed<   dgZ
ee	         ed	<   dZee	         dz  ed
<   dZee	         dz  ed<   dZee	         dz  ed<   dZee	         dz  ed<   dZedz  ed<   dZee	         dz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZee	         dz  ed<   dZee	         dz  ed<   dZedz  ed<   dZee	         dz  ed<   dZee	         dz  ed<   dZee	         dz  ed<   dZedz  ed<   dS )OAuthMetadataz{
    RFC 8414 OAuth 2.0 Authorization Server Metadata.
    See https://datatracker.ietf.org/doc/html/rfc8414#section-2
    issuerauthorization_endpointtoken_endpointNregistration_endpointscopes_supportedrB   response_types_supportedresponse_modes_supportedgrant_types_supported%token_endpoint_auth_methods_supported0token_endpoint_auth_signing_alg_values_supportedservice_documentationui_locales_supportedop_policy_uri
op_tos_urirevocation_endpoint*revocation_endpoint_auth_methods_supported5revocation_endpoint_auth_signing_alg_values_supportedintrospection_endpoint-introspection_endpoint_auth_methods_supported8introspection_endpoint_auth_signing_alg_values_supported code_challenge_methods_supported%client_id_metadata_document_supported)r   r    r!   r"   r   r#   re   rf   rY   r   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   boolr&   r   r   ra   ra   l   s         
 &&&&/3:,333)-d3i$&---+1(d3i22215d3i$.555.249t+222>B)49t+;BBBIM4d3i$6FMMM/3:,333-1$s)d*111'+M:$+++$(J
T!(((-1d*111CG.S	D0@GGGNR949t;KRRR04J-444FJ149t3CJJJQU<d3i$>NUUU9=$d3i$&6===9=)4$;=====r   ra   c                      e Zd ZU dZeed<    edd          Zee         ed<   dZ	edz  ed<   dZ
ee         dz  ed	<    ed
g          Zee         dz  ed<   dZee         dz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZee         dz  ed<   dZee         dz  ed<   dZedz  ed<   dS )ProtectedResourceMetadatazy
    RFC 9728 OAuth 2.0 Protected Resource Metadata.
    See https://datatracker.ietf.org/doc/html/rfc9728#section-2
    resource.r7   r8   authorization_serversNrJ   rf   header)defaultbearer_methods_supported%resource_signing_alg_values_supportedresource_nameresource_documentationresource_policy_uriresource_tos_uri*tls_client_certificate_bound_access_tokens%authorization_details_types_supported!dpop_signing_alg_values_supported!dpop_bound_access_tokens_required)r   r    r!   r"   r   r#   r   r|   rY   rJ   rf   r   r   r   r   r   r   r   r   rx   r   r   r   r&   r   r   rz   rz      su         
 .3eCA.F.F.F4
+FFF"&Hj4&&&)-d3i$&---16z1J1J1Jd3i$.JJJ>B)49t+;BBB $M3:$$$04J-444-1d*111*.j4'...>B.tBBB>B)49t+;BBB:>%tCy4'7>>>59%td{99999r   rz   N)typingr   r   pydanticr   r   r   r   r	   r   	Exceptionr(   r3   r6   r[   ra   rz   r&   r   r   <module>r      s           J J J J J J J J J J J J J J       *    	   
    i   
8u 8u 8u 8u 8u) 8u 8u 8uv	0 	0 	0 	0 	0!4 	0 	0 	0> > > > >I > > ><: : : : :	 : : : : :r   