Skip to content

Commit

Permalink
use TokenStore interface
Browse files Browse the repository at this point in the history
  • Loading branch information
axiomofjoy committed Sep 20, 2024
1 parent 80d3a8f commit a31d6fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/phoenix/server/api/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from phoenix.server.bearer_auth import PhoenixUser, create_access_and_refresh_tokens
from phoenix.server.email.templates.types import PasswordResetTemplateBody
from phoenix.server.email.types import EmailSender
from phoenix.server.jwt_store import JwtStore
from phoenix.server.rate_limiters import ServerRateLimiter, fastapi_ip_rate_limiter
from phoenix.server.types import (
AccessTokenClaims,
Expand Down Expand Up @@ -72,7 +71,7 @@
async def login(request: Request) -> Response:
assert isinstance(access_token_expiry := request.app.state.access_token_expiry, timedelta)
assert isinstance(refresh_token_expiry := request.app.state.refresh_token_expiry, timedelta)
token_store: JwtStore = request.app.state.get_token_store()
token_store: TokenStore = request.app.state.get_token_store()
data = await request.json()
email = data.get("email")
password = data.get("password")
Expand Down
4 changes: 2 additions & 2 deletions src/phoenix/server/api/routers/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
from phoenix.db import models
from phoenix.db.enums import UserRole
from phoenix.server.bearer_auth import create_access_and_refresh_tokens
from phoenix.server.jwt_store import JwtStore
from phoenix.server.oauth2 import OAuth2Client
from phoenix.server.rate_limiters import (
ServerRateLimiter,
fastapi_ip_rate_limiter,
fastapi_route_rate_limiter,
)
from phoenix.server.types import TokenStore

_LOWERCASE_ALPHANUMS_AND_UNDERSCORES = r"[a-z0-9_]+"

Expand Down Expand Up @@ -116,7 +116,7 @@ async def create_tokens(
return _redirect_to_login(error=_INVALID_OAUTH2_STATE_MESSAGE)
assert isinstance(access_token_expiry := request.app.state.access_token_expiry, timedelta)
assert isinstance(refresh_token_expiry := request.app.state.refresh_token_expiry, timedelta)
token_store: JwtStore = request.app.state.get_token_store()
token_store: TokenStore = request.app.state.get_token_store()
if not isinstance(
oauth2_client := request.app.state.oauth2_clients.get_client(idp_name), OAuth2Client
):
Expand Down

0 comments on commit a31d6fe

Please sign in to comment.