我有一个使用identityserver4框架的Identity Server,它的url是
http://localhost:9000
我的Web应用程序是asp.net core 2.0,其URL是http://localhost:60002.此应用程序将使用Identity Server的登录页面.
我希望登录后,Identity Server将重定向到应用程序页面(http://localhost:60002)
这是客户端应用程序的Startup.cs
Startup.cs
public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } private string AuthorityUri => Configuration.GetValue<string>("UserManagement-Authority"); // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); services.AddAuthentication(options => { options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; }) .AddCookie() .AddOpenIdConnect(options => { options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Authority = AuthorityUri; // "http://localhost:9000" options.RequireHttpsMetadata = false; options.ClientId = "customer.api"; options.ClientSecret = "testsecret"; options.ResponseType = "code id_token"; options.Scope.Add("customerprivatelinesvn.api"); options.Scope.Add("offline_access"); options.GetClaimsFromUserInfoEndpoint = true; options.SaveTokens = true; }); services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app,IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true }); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default",template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback",defaults: new { controller = "Home",action = "Index" }); }); } }
这是Identity Server上的登录页面
但是有一个无限循环调用http://localhost:9000/connect/authorize端点,然后它返回到http://localhost:60002/signin-oidc,“Bad Request – Request Too Long”如下所示.
当我查看cookie时,有很多项目“.AspNetCore.Correlation.OpenIdConnect.xxx”
这是在Identiy Server上的日志.它说Identiy.Application已成功通过身份验证.
有谁知道这个问题是什么?以及如何解决这个问题?非常感谢你.
最好的祝福,
凯文
解决方法
好吧,您的Identity Server日志中显示了很长的请求 – 错误显示“错误请求 – 请求时间过长”.我猜这个问题是你的请求太大了:)
maximum length of HTTP GET request?
maximum length of HTTP GET request?
你试过发帖而不是使用GET吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。