Exemple #1
0
        public Startup()
        {
            PublicClientId = "self";
            var container = MvcApplication.BootstrapContainer();
            var session   = container.Resolve <ISession>();
            var exManager = container.Resolve <ExceptionManager>();
            var log       = container.Resolve <ILogger>();

            UserManagerFactory = new UserManager <User>(new UserRepository(session, exManager, log));
            RoleManagerFactory = new RoleManager <Role>(new RoleRepository(session, exManager, log));

            CookieOptions = new CookieAuthenticationOptions();

            OAuthOptions = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath         = new PathString("/Token"),
                Provider                  = new ApplicationOAuthProvider(PublicClientId, () => UserManagerFactory),
                AuthorizeEndpointPath     = new PathString("/api/Account/ExternalLogin"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                AllowInsecureHttp         = true
            };
        }