1818from starlette .applications import Starlette
1919
2020from mcp .server .auth .provider import (
21- AuthInfo ,
21+ AccessToken ,
2222 AuthorizationCode ,
2323 AuthorizationParams ,
2424 OAuthServerProvider ,
@@ -88,7 +88,7 @@ async def exchange_authorization_code(
8888 refresh_token = f"refresh_{ secrets .token_hex (32 )} "
8989
9090 # Store the tokens
91- self .tokens [access_token ] = AuthInfo (
91+ self .tokens [access_token ] = AccessToken (
9292 token = access_token ,
9393 client_id = client .client_id ,
9494 scopes = authorization_code .scopes ,
@@ -151,7 +151,7 @@ async def exchange_refresh_token(
151151 new_refresh_token = f"refresh_{ secrets .token_hex (32 )} "
152152
153153 # Store the new tokens
154- self .tokens [new_access_token ] = AuthInfo (
154+ self .tokens [new_access_token ] = AccessToken (
155155 token = new_access_token ,
156156 client_id = client .client_id ,
157157 scopes = scopes or token_info .scopes ,
@@ -172,27 +172,27 @@ async def exchange_refresh_token(
172172 refresh_token = new_refresh_token ,
173173 )
174174
175- async def load_access_token (self , token : str ) -> AuthInfo | None :
175+ async def load_access_token (self , token : str ) -> AccessToken | None :
176176 token_info = self .tokens .get (token )
177177
178178 # Check if token is expired
179179 # if token_info.expires_at < int(time.time()):
180180 # raise InvalidTokenError("Access token has expired")
181181
182- return token_info and AuthInfo (
182+ return token_info and AccessToken (
183183 token = token ,
184184 client_id = token_info .client_id ,
185185 scopes = token_info .scopes ,
186186 expires_at = token_info .expires_at ,
187187 )
188188
189- async def revoke_token (self , token : AuthInfo | RefreshToken ) -> None :
189+ async def revoke_token (self , token : AccessToken | RefreshToken ) -> None :
190190 match token :
191191 case RefreshToken ():
192192 # Remove the refresh token
193193 del self .refresh_tokens [token .token ]
194194
195- case AuthInfo ():
195+ case AccessToken ():
196196 # Remove the access token
197197 del self .tokens [token .token ]
198198
0 commit comments