Owin startup and authentication providers

You can use external (often called social) login providers, for example Google or Facebook.

About OWIN

OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools.

Create an Owin startup class

To use external login providers on your site you need to create an Owin startup class that will be used during startup and register and enable the external providers.

Since Litium Studio already contains a startup class for Owin that registers the default providers needed to get Litium Studio running, you need to add an appSettings value in your web.config. Otherwise the system will not use the class during startup.

Create a new class named Startup in namespace Litium.Studio.Accelerator. To use that startup class during startup, add the appSettings:

<add key="owin:AppStartup" value="Litium.Studio.Accelerator.Startup" />

Install needed assemblies

The startup class will be as follows using Litium.Studio.Accelerator. But to be able to use the class you need to add some assemblies, otherwise the project will not compile. The easiest way to install the assemblies is to use the Nuget package manager console. Select "Litium.Studio.Accelerator" as default project and run the following command to install the assemblies needed:

Install-Package Owin
Install-Package Microsoft.Owin.Security.Cookies
Install-Package Microsoft.AspNet.Identity.Core
Install-Package Microsoft.AspNet.Identity.Owin
Install-Package Microsoft.Owin.Host.SystemWeb

Install external login providers

To use third party providers like Facebook or Microsoft Live their packages also need to be installed (a full list of providers that Microsoft already built can be found here http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity).

And the Startup class itself:

using Litium.Studio.Accelerator;
using Litium.Studio.Lifecycle;
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;

[assembly: OwinStartup(typeof(Startup))]

namespace Litium.Studio.Accelerator
    public class Startup
        /// <summary> 
        /// Configurations the specified application. 
        /// </summary>
        ///<param name="app" />The application. </param>
        public void Configuration(IAppBuilder app) 
            // Enable the temporary external cookie used during login 
            // Enable third party authentication providers 


Is this page helpful?
Thank you for your feedback!