+
    wi'                        ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
HtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHtHtHt ^ R
IHt  ! R R]4      t ! R R]4      t  ! R R]]]] ,          ]! RR7      3,          ,          4      t! ! R R]4      t" ! R R]],          4      t#] ! R R4      4       t$R# )    N)	dataclass)	AnnotatedAnyLiteral)
AnyHttpUrlAnyUrl	BaseModelField	RootModelValidationErrorRequest)stringify_pydantic_error)PydanticJSONResponse)AuthenticationErrorClientAuthenticator) OAuthAuthorizationServerProvider
TokenErrorTokenErrorCode
OAuthTokenc                      a  ] tR t^t o ]! RRR7      t]! RRR7      tRt]! RRR7      t]! RRR7      t	V 3R lt
R	tV tR# )
AuthorizationCodeRequest.zThe authorization codedescriptionNz7Must be the same as redirect URI provided in /authorizezPKCE code verifier Resource indicator for the tokenc                   < V ^8  d   Qh/ S[ R,          ;R&   S[;R&   S[R,          ;R&   S[;R&   S[R,          ;R&   S[;R&   S[R,          ;R	&   # )
   authorization_code
grant_typecodeNredirect_uri	client_idclient_secretcode_verifierresource)r   strr   )format__classdict__s   "R/home/ubuntu/.local/lib/python3.14/site-packages/mcp/server/auth/handlers/token.py__annotate__%AuthorizationCodeRequest.__annotate__   so     ,--  @  4-t	 
 N  :$  E  DjV      )__name__
__module____qualname____firstlineno__r
   r!   r"   r$   r%   r&   __annotate_func____static_attributes____classdictcell__r)   s   @r*   r   r      sI      c'?@D"':s"tL !%Ms0DEM 3UVH  r-   r   c                   l   a  ] tR t^t o ]! RRR7      t]! RRR7      tRt]! RRR7      tV 3R lt	Rt
V tR# )	RefreshTokenRequest.zThe refresh tokenr   NzOptional scope parameterr   c                   < V ^8  d   Qh/ S[ R,          ;R&   S[;R&   S[R,          ;R&   S[;R&   S[R,          ;R&   S[R,          ;R&   # )r   refresh_tokenr    Nscoper#   r$   r&   )r   r'   )r(   r)   s   "r*   r+    RefreshTokenRequest.__annotate__   sa     ((  D  :K	 
 N  :$  DjV r-   r.   )r/   r0   r1   r2   r
   r:   r;   r$   r&   r3   r4   r5   r6   s   @r*   r8   r8      s<      s0CDMd0JKE !%M 3UVH  r-   r8   c                   ,   a  ] tR t^+t o V 3R ltRtV tR# )TokenRequestc                Z   < V ^8  d   Qh/ S[ S[S[,          S[! RR7      3,          ;R&   # )r   r    discriminatorroot)r   r   r8   r
   )r(   r)   s   "r*   r+   TokenRequest.__annotate__+   s/       #66L)	+  r-   r.   Nr/   r0   r1   r2   r3   r4   r5   r6   s   @r*   r>   r>   +         r-   r>   r    r@   c                   8   a  ] tR t^9t o RtRtRtV 3R ltRtV t	R# )TokenErrorResponsez?
See https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
Nc                Z   < V ^8  d   Qh/ S[ ;R&   S[R,          ;R&   S[R,          ;R&   # )r   errorNerror_description	error_uri)r   r'   r   )r(   r)   s   "r*   r+   TokenErrorResponse.__annotate__9   s5     
   Tz(  D ' r-   r.   )
r/   r0   r1   r2   __doc__rJ   rK   r3   r4   r5   r6   s   @r*   rG   rG   9   s     
 %)#'I  r-   rG   c                   ,   a  ] tR t^Ct o V 3R ltRtV tR# )TokenSuccessResponsec                &   < V ^8  d   Qh/ S[ ;R&   # )r   rB   r   )r(   r)   s   "r*   r+   !TokenSuccessResponse.__annotate__C   s      	 r-   r.   NrD   r6   s   @r*   rO   rO   C   rE   r-   rO   c                   P   a  ] tR t^Jt o V 3R lR ltV 3R lR ltV 3R ltRtV tR# )TokenHandlerc                0   < V ^8  d   QhRS[ S[,          /# )r   obj)rO   rG   )r(   r)   s   "r*   r+   TokenHandler.__annotate__O   s     
 
03EE 
r-   c                Z    ^p\        V\        4      '       d   Rp\        VVRRRR/R7      # )   i  Cache-Controlno-storePragmano-cachecontentstatus_codeheaders)
isinstancerG   r   )selfrU   r_   s   && r*   responseTokenHandler.responseO   s<    c-..K##*
 	
r-   c                    < V ^8  d   QhRS[ /# )r   requestr   )r(   r)   s   "r*   r+   rV   ]   s     T@ T@G T@r-   c           	     ~
  "    V P                   P                  V4      G R j  xL
 p TP                  4       G R j  xL
 p\        P                  \        T4      4      P                  pTP                  TP                  9  d+   T P                  \	        R
RTP                   R2R7      4      # T;\         Rc ;Ee   w    T P"                  P%                  Y%P&                  4      G R j  xL
 pTe   TP(                  TP(                  8w  d   T P                  \	        RRR7      4      # TP*                  \,        P,                  ! 4       8  d   T P                  \	        RRR7      4      # TP.                  '       d   TP0                  pMR pTP0                  e   \3        TP0                  4      MR p	Te   \3        T4      MR p
Y8w  d   T P                  \	        R	RR7      4      # \4        P6                  ! TP8                  P;                  4       4      P=                  4       p\>        P@                  ! T4      PC                  4       PE                  R4      pYPF                  8w  d   T P                  \	        RRR7      4      #  T P"                  PI                  Y'4      G R j  xL
 pEMe \P        Rc ;EeX   w   T P"                  PS                  Y%PT                  4      G R j  xL
 pTe   TP(                  TP(                  8w  d   T P                  \	        RRR7      4      # TP*                  '       dA   TP*                  \,        P,                  ! 4       8  d   T P                  \	        RRR7      4      # TPV                  '       d   TPV                  PY                  R4      MTPZ                  pT F6  pTTPZ                  9  g   K  T P                  \	        RRT R2R7      4      u # 	   T P"                  P]                  Y.T4      G R j  xL
 pM T P                  \_        XR7      4      #  EL  \         d2   p\        \	        RTP
                  R7      RRRRR/R7      u R p?# R p?ii ; i EL'  \         d0   pT P                  \	        R	\        T4      R7      4      u R p?# R p?ii ; i EL EL  \J         d;   pT P                  \	        TPL                  TPN                  R7      4      u R p?# R p?ii ; i EL L  \J         d;   pT P                  \	        TPL                  TPN                  R7      4      u R p?# R p?ii ; i5i)Nunauthorized_client)rI   rJ   i  rY   rZ   r[   r\   r]   invalid_requestunsupported_grant_typez2Unsupported grant type (supported grant types are )r.   invalid_grantz!authorization code does not existzauthorization code has expiredz?redirect_uri did not match the one used when creating auth code=zincorrect code_verifierzrefresh token does not existzrefresh token has expired invalid_scopezcannot request scope `z` not provided by refresh token)rB   )0client_authenticatorauthenticate_requestr   r   rG   messageformr>   model_validatedictrB   r   rc   r   r    grant_typesr   providerload_authorization_coder!   r#   
expires_attime redirect_uri_provided_explicitlyr"   r'   hashlibsha256r%   encodedigestbase64urlsafe_b64encodedecoderstripcode_challengeexchange_authorization_coder   rI   rJ   r8   load_refresh_tokenr:   r;   splitscopesexchange_refresh_tokenrO   )rb   rf   client_infoe	form_datatoken_requestvalidation_error	auth_codeauthorize_request_redirect_uritoken_redirect_strauth_redirect_strr}   hashed_code_verifiertokensr:   r   r;   s   &&               r*   handleTokenHandler.handle]   s    	 $ 9 9 N Nw WWK		%lln,I(77YHMMM ##;+B+BB=="2)[\g\s\s[ttu'v  +)++"&--"G"GUgUg"hh	$	(;(;}?V?V(V==*"1.Q  ''$))+5==*"1.N  ===5>5K5K2592 IVHbHbHnS)C)C%Dtx";Y;eC67ko " &:==*"3/p  !(C(C(J(J(LMTTV'-'?'?'G'N'N'P'W'WX['\$'+C+CC==*"1.G 	#'==#L#L[#ddFs ,D %&&&*mm&F&F{ToTo&p p (M,C,C}G^G^,^==*"1.L  !+++0H0H499;0V==*"1.I  <I;N;N;N,,2237TaThTh#EM$8$88#}}.&55KE7Rq3r   $	#'==#G#Gdj#kkFE 'V }}1v>??e X" 	'*/&'ii  #Zj
 
	 - 	=="+&>?O&P 	( ip e! ==*"#''./.A.A  !qB l! ==*"#''./.A.A s6  T=P# P P# Q% Q",Q% (A>T=&R"'BT=8DT=;R( R%R( 9T=S0AT=)AT=;:T=:$T=S5 >S3?S5 T= P# #Q.&QQT=QT="Q% %R0$RRT=RT=%R( (S-3/S("S-#T=(S--T=3S5 5T: /T5/T:0T=5T::T=c                L   < V ^8  d   Qh/ S[ S[S[S[3,          ;R&   S[;R&   # )r   rw   rp   )r   r   r   )r(   r)   s   "r*   r+   rV   J   s(     .sC}==  .- r-   r.   N)	r/   r0   r1   r2   rc   r   r3   r4   r5   r6   s   @r*   rS   rS   J   s$     

 
T@ T@'  r-   rS   )%r   r|   rz   dataclassesr   typingr   r   r   pydanticr   r   r	   r
   r   r   starlette.requestsr   mcp.server.auth.errorsr   mcp.server.auth.json_responser   &mcp.server.auth.middleware.client_authr   r   mcp.server.auth.providerr   r   r   mcp.shared.authr   r   r8   r>   rG   rO   rS   r.   r-   r*   <module>r      s       ! * * U U & ; > [ a a &Wy W	W) 	W$'::-/	
( (9Z0  f@ f@ f@r-   