asp.netauthenticationservicestackasp-net-mvc-1

ServiceStack Authentication flow


I’m integrating ServiceStack authentication in my own web app. The flow that I’m trying to implementing is

  1. Calling Authenticate method of my own AuthProvider
  2. If the authentication against authRepository returning true, the user will be redirect to another view where he must insert a code. If false it returns Unauthorized
  3. If the code is ok, then the app make a post authenticate request (with Skip Password Verification if in process)

My question is: which is the best way to redirect the user to the url that he initially has requested? Is it correct get the authentication response in this controller and performing a redirect to action inside the method? I can’t figure out how servicestack works with authenticate attribute


Solution

  • My question is: which is the best way to redirect the user to the url that he initially has requested?

    Typically on login page would contain the URL the user wants to redirect back to in a ?ReturnUrl=... param which I would forward and include in the URL for the page you redirect to to capture the code, e.g. /verifycode?ReturnUrl....

    Which the controller that validates the code would use in order to redirect the user back to their original URL.