refactor: 根据最新依赖组件使用内部模拟用户功能

This commit is contained in:
Argo Zhang 2019-07-01 20:46:08 +08:00
parent b54a1fcc82
commit 0c1299e9ea
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 1 additions and 18 deletions

View File

@ -1,8 +1,5 @@
using Bootstrap.Security.DataAccess;
using Longbow.Configuration;
using Longbow.Web;
using Longbow.Web;
using Longbow.Web.SignalR;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -12,7 +9,6 @@ using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Security.Claims;
namespace Bootstrap.Client
{
@ -92,19 +88,6 @@ namespace Bootstrap.Client
app.UseResponseCompression();
app.UseStaticFiles();
app.UseCookiePolicy();
#if DEBUG
app.Use(async (context, next) =>
{
var userName = ConfigurationManager.GetValue("SimulateUserName", string.Empty);
if (!string.IsNullOrEmpty(userName))
{
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
identity.AddClaim(new Claim(ClaimTypes.Name, userName));
context.User = new ClaimsPrincipal(identity);
}
await next();
});
#endif
app.UseBootstrapAdminAuthentication();
app.UseCacheManagerCorsHandler();
app.UseSignalR(routes => { routes.MapHub<SignalRHub>("/NotiHub"); });