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

For the session_auth_axum example, move the passhash into a separate non-serializable struct. #2446

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

rcythr
Copy link
Contributor

@rcythr rcythr commented Mar 19, 2024

The current example for session_auth_axum has a serializable User struct which contains the user's hashed password:

https://github.com/leptos-rs/leptos/blob/fda4dba2370fdb4f5f81961bdeb7ca139d2e612d/examples/session_auth_axum/src/auth.rs#L5C1-L11C2

This change separates the password hash into a new, non-serializable struct to prevent it from being returned to the client. Existing auth logic is modified to use new versions of User::get and User::get_from_username which return (User, UserPasshash) tuples.

non-serializable struct.

This prevents it from being returned in the
get_user() API, and prevents it from being unintentionally returned on any
new API the end-user may create on top of this example code.
@benwis
Copy link
Contributor

benwis commented Mar 19, 2024

LGTM, thanks for your contribution!

@benwis benwis merged commit 7ef186f into leptos-rs:main Mar 19, 2024
10 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.

None yet

2 participants