示例#1
0
        public void Configuration(IAppBuilder app)
        {
            //第一步:配置跨域访问
            app.UseCors(CorsOptions.AllowAll);

            app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);

            //第二步:使用OAuth密码认证模式
            app.UseOAuthAuthorizationServer(OAuthOptions.CreateServerOptions());

            //第三步:使用Abp
            app.UseAbp();



            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath          = new PathString("/Account/Login")
            });

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            app.MapSignalR();

            //ENABLE TO USE HANGFIRE dashboard (Requires enabling Hangfire in MyAbpProjectWebModule)
            //app.UseHangfireDashboard("/hangfire", new DashboardOptions
            //{
            //    Authorization = new[] { new AbpHangfireAuthorizationFilter() } //You can remove this line to disable authorization
            //});
        }
示例#2
0
        public virtual void Configuration(IAppBuilder app)
        {
            app.UseAbp();

            //配置跨域访问
            app.UseCors(CorsOptions.AllowAll);
            //使用OAuth 2.0 密码认证模式
            app.UseOAuthAuthorizationServer(OAuthOptions.CreateServerOptions());
            //app.UseOAuthBearerTokens(OAuthOptions.CreateServerOptions());

            //设置abp基于token的验证方式
            app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);

            //注册cookie属性
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                //登录入口
                LoginPath = new PathString("/J_Account/Login")
            });
            ////app.UseStaticFiles();
            ////app.UseEmbeddedFiles(); //允许暴露嵌入式文件到web中!

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            app.MapSignalR();

            // 有关如何配置应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkID=316888
        }
示例#3
0
        public void Configuration(IAppBuilder app)
        {
            app.UseAbp();
            app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);
            app.UseOAuthAuthorizationServer(OAuthOptions.CreateServerOptions());

            // 使应用程序能够使用cookie存储登录用户的信息
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath          = new PathString("/Account/Login")
            });

            // 使用cookie临时存储关于用第三方登录提供程序登录的用户的信息
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
        }