I'm creating an ASP.NET MVC 4 app using the service stack MVC powerpack, utilizing service stack's auth and session providers. I'm copying lot of logic from the social bootstrap API project. My controllers inherit from the following base controller:
public class ControllerBase : ServiceStackController<CustomUserSession>
which is implemented as:
public class ControllerBase : ServiceStackController<CustomUserSession> {}
CustomUserSession
inherits from AuthUserSession
:
public class CustomUserSession : AuthUserSession
After I log in, my CustomUserSession
OnAuthenticated()
method runs, but when I redirect back to my controller, the UserSession
is not populated, e.g.
public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IOAuthTokens tokens, Dictionary<string, string> authInfo)
{
base.OnAuthenticated(authService, session, tokens, authInfo);
CustomFoo = "SOMETHING CUSTOM";
// More stuff
}
public class MyController : ControllerBase
{
public ActionResult Index()
{
// After having authenticated
var isAuth = base.UserSession.IsAuthenticated; // This is always false
var myCustomFoo = base.UserSession.CustomFoo; // This is always null
}
}
Can anyone see what I'm missing here?