EnVisageOnline/Main/Source/EnVisage/App_Start/Startup.Auth.cs

53 lines
2.0 KiB
C#

using Microsoft.AspNet.Identity;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
using System;
using System.Web.Configuration;
namespace EnVisage
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Uncomment the following lines to enable logging in with third party login providers
app.UseMicrosoftAccountAuthentication(
clientId: "000000004C118C1C",
clientSecret: "s6A3ycbdEVSqgpzNynfHAiidWebpuFed");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
//app.UseFacebookAuthentication(
// appId: "",
// appSecret: "");
app.UseGoogleAuthentication();
}
public void ConfigureSignalR(IAppBuilder app)
{
if (WebConfigurationManager.ConnectionStrings["SignalRBackplanConnection"] != null)
{
string sqlconnection = WebConfigurationManager.ConnectionStrings["SignalRBackplanConnection"].ConnectionString;
GlobalHost.DependencyResolver.UseSqlServer(sqlconnection);
}
GlobalHost.Configuration.TransportConnectTimeout = TimeSpan.FromSeconds(15);
app.SanitizeThreadCulture();
app.MapSignalR();
}
}
}