Skip to content

Registration with autologin fails when using the RavenUserAuthRepository#23

Merged
mythz merged 1 commit intoServiceStackV3:masterfrom
Aaronaught:master
Jun 30, 2013
Merged

Registration with autologin fails when using the RavenUserAuthRepository#23
mythz merged 1 commit intoServiceStackV3:masterfrom
Aaronaught:master

Conversation

@Aaronaught
Copy link
Copy Markdown
Contributor

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 autoLogin set (i.e. using the RegistrationFeature) 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 (via GetUserAuthByUserName), it's not in the index yet.

Adding WaitForNonStaleResultsAsOfNow ensures 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.

…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
@mythz mythz merged commit 40ed477 into ServiceStackV3:master Jun 30, 2013
@mythz
Copy link
Copy Markdown
Contributor

mythz commented Jun 30, 2013

Awesome! thx.

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