Registration with autologin fails when using the RavenUserAuthRepository#23
Merged
mythz merged 1 commit intoServiceStackV3:masterfrom Jun 30, 2013
Merged
Registration with autologin fails when using the RavenUserAuthRepository#23mythz merged 1 commit intoServiceStackV3:masterfrom
mythz merged 1 commit intoServiceStackV3:masterfrom
Conversation
…hods needs to be aware of background indexing.
mythz
added a commit
that referenced
this pull request
Jun 30, 2013
Registration with autologin fails when using the RavenUserAuthRepository
Contributor
|
Awesome! thx. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RavenDB uses background indexing and allows the use of stale indexes by default, which is great for a lot of things, but security generally isn't one of them.
Specifically, if you try to register with
autoLoginset (i.e. using theRegistrationFeature) while using the RavenDB repository, you end up with an "Invalid UserName or Password" error at the end of it. That is because the service immediately attempts a login after creating the user auth, and when it goes to retrieve the auth document afterward (viaGetUserAuthByUserName), it's not in the index yet.Adding
WaitForNonStaleResultsAsOfNowensures that any recent user creations/saves are reflected in the query. I've added it to the OAuth queries too, since they are susceptible to similar issues.