Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT -> Redis #3574

Merged
merged 16 commits into from
Jan 4, 2025
Merged

JWT -> Redis #3574

merged 16 commits into from
Jan 4, 2025

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Jan 1, 2025

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)

Copy link

vercel bot commented Jan 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 4, 2025 7:07pm

logger.debug(
"Token data not found or expired in Redis, defaulting to POSTGRES_DEFAULT_SCHEMA"
)
return POSTGRES_DEFAULT_SCHEMA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of returning POSTGRES_DEFAULT_SCHEMA in the multi tenant case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth error (which is what we'd want!)


def __init__(
self,
lifetime_seconds: Optional[int] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a default of none if the whole point of this was to enforce expiration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went along with FastAPI User's convention: https://github.com/fastapi-users/fastapi-users/blob/9d78b2a35dc7f35c2ffca67232c11f4d27a5db00/fastapi_users/authentication/strategy/redis.py#L11

Purpose of the PR was more so to enforce logout functionality-related expiration, but I think we should probably add a constant or config related to this! Will do so

async def read_token(
self, token: Optional[str], user_manager: BaseUserManager[User, uuid.UUID]
) -> Optional[User]:
if not token:
Copy link
Contributor

@rkuo-danswer rkuo-danswer Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should token be optional if we just return None immediately when it is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above, but agree! Unnecessary

{!NEXT_PUBLIC_CLOUD_ENABLED && (
<Checkbox
label="Anonymous Users"
sublabel="If set, users will not be required to sign in to use Danswer."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Danswer -> Onyx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@pablonyx pablonyx enabled auto-merge January 4, 2025 19:03
@pablonyx pablonyx added this pull request to the merge queue Jan 4, 2025
Merged via the queue into main with commit ffec196 Jan 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants