I have recently created web services using authentication and roles through ServiceStack 4 including openId and OAuth providers Google, Twitter and LinkedIn backed by a MongoDB repository.
I would like to integrate those services with my ASP.NET 5 MVC website that currently uses Microsoft's new Identity (OWIN) framework with the same providers for registration, authentication and roles.
I would prefer to use ServiceStack for authentication, registration and roles and have my MVC Controllers authorize against that. I've read the posts regarding SimpleMembership
and the wiki around Authorization and Session Handling in ServiceStack.
What I would like to know is if there is a starter template or example that takes the latest MVC 5 template and replaces/integrates that with ServiceStack 4.
Specifically, how does the existing AccountController
, IdentityUser
, UserManager
and UserStore
get replaced/modified to use ServiceStack?
What I would like to know is if there is a starter template or example that takes the latest MVC 5 template and replaces/integrates that with ServiceStack 4.
ServiceStackVS is an extension which allows to create ServiceStack powered projects from scratch. There is a template for ASP.NET MVC 5.
Specifically, how does the existing AccountController, IdentityUser, UserManager and UserStore get replaced/modified to use ServiceStack?
Specifically, all of your controllers need to inherit from ServiceStackController<T>
(where T
is IAuthSession
).
in your Global.asax's Application_Start
you need to initialize your AppHost.
Then, you have something like that
public class MyAppHost : AppHostBase
{
public MyAppHost() : base("My Service Name")
{
}
public override void Configure(Container container)
{
// Configure your container here (authentication, plugins...)
}
}
public class MvcApplication : HttpApplication
{
private MyAppHost AppHost { get; set; }
protected void Application_Start()
{
//...
AppHost = new MyAppHost(this).Init();
ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(AppHost.Container));
//...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With