Skip to content

Fix auth #2167

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

Merged
merged 3 commits into from
Jan 27, 2020
Merged

Fix auth #2167

merged 3 commits into from
Jan 27, 2020

Conversation

carols10cents
Copy link
Member

Set the TrustedUserId in the extensions when logging in

Fixes #2166.

In #2077 (d0b9bcc), we changed the type of the authentication data stored in the extensions from User to TrustedUserId, but we missed this spot :( We're allowed to insert anything we want into the extensions, but if we use a different type than what we use when looking up data in the extensions, it won't find what we inserted.

I checked all the other locations of mut_extensions and extensions and I think they're good, but overall this system feels a bit loosey-goosey to me. Not sure how to improve it, though.

r? @jtgeibel

Fixes rust-lang#2166.

In rust-lang#2077 (d0b9bcc), we changed the type
of the authentication data stored in the extensions from `User` to
`TrustedUserId`, but we missed this spot :( We're allowed to insert
anything we want into the extensions, but if we use a different type
than what we use when looking up data in the extensions, it won't find
what we inserted.
Because we're only storing the user ID in the extensions rather than the
whole `User`, we're always looking up the user in the database, so this
comment saying the user lookup isn't preferable is out of date.
@jtgeibel
Copy link
Member

Great catch, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 27, 2020

📌 Commit 949d294 has been approved by jtgeibel

@bors
Copy link
Contributor

bors commented Jan 27, 2020

⌛ Testing commit 949d294 with merge def94b3...

bors added a commit that referenced this pull request Jan 27, 2020
Fix auth

Set the TrustedUserId in the extensions when logging in

Fixes #2166.

In #2077 (d0b9bcc), we changed the type of the authentication data stored in the extensions from `User` to `TrustedUserId`, but we missed this spot :( We're allowed to insert anything we want into the extensions, but if we use a different type than what we use when looking up data in the extensions, it won't find what we inserted.

I checked all the other locations of `mut_extensions` and `extensions` and I think they're good, but overall this system feels a bit loosey-goosey to me. Not sure how to improve it, though.

r? @jtgeibel
@bors
Copy link
Contributor

bors commented Jan 27, 2020

☀️ Test successful - checks-travis
Approved by: jtgeibel
Pushing def94b3 to master...

@bors bors merged commit 949d294 into rust-lang:master Jan 27, 2020
@carols10cents carols10cents deleted the fix-auth branch January 27, 2020 21:59
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.

Logging in for the very first time always fails (in production), works on 2nd try
4 participants