-
Notifications
You must be signed in to change notification settings - Fork 0
/
Startup.cs
68 lines (51 loc) · 2.13 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Configuration;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
using TExp.App_Start;
using TExp.Models;
using System.Diagnostics;
using System.Web.Http;
//using TExp.Providers;
//using TExp.Security;
[assembly: OwinStartup(typeof(TExp.Startup))]
namespace TExp
{
public class Startup
{
public static string PublicClientId { get; private set; }
public Startup()
{
}
public void Configuration(IAppBuilder app)
{
#if DEBUG
Debug.WriteLine("Startup Configuration");
#endif
app.CreatePerOwinContext(MyDbContext.Create);
app.CreatePerOwinContext<MyUserManager>(MyUserManager.Create);
app.CreatePerOwinContext<MySignInManager>(MySignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
ReturnUrlParameter = "returnUrl",
ExpireTimeSpan = TimeSpan.FromDays(Convert.ToInt32(ConfigurationManager.AppSettings["ExpireTimeAuth"]))
/*Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MyUserManager, t_User>(
validateInterval: TimeSpan.FromMinutes(20),
regenerateIdentity: (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie))
}
*/
}
);
}
}
}