【发布时间】:2020-04-27 15:00:00
【问题描述】:
我正在尝试将 OpenIddict 3.0 用于 SSO 应用程序。我按照文档中的步骤,创建了一个 Authorize 控制器,并添加了一个测试应用程序。当我尝试连接授权时,我得到了这个异常:
System.InvalidOperationException:未处理授权请求。要处理授权请求,请创建一个实现“IOpenIddictServerHandler”的类并使用“services.AddOpenIddict().AddServer().AddEventHandler()”注册它。
或者,启用直通模式以在稍后阶段处理它们。
我在文档或示例应用程序中找不到任何解释这意味着什么的内容。我错过了什么?
到目前为止,这是我的代码。在Startup.cs:
services.AddOpenIddict()
.AddCore(o =>
{
o.UseEntityFrameworkCore().UseDbContext<ApplicationDbContext>();
})
.AddServer(o =>
{
o.SetTokenEndpointUris("/connect/token");
o.SetAuthorizationEndpointUris("/connect/authorize");
o.AllowAuthorizationCodeFlow();
o.RegisterScopes(OpenIddictConstants.Scopes.Email);
o.AcceptAnonymousClients();
o.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
o.UseAspNetCore()
.EnableTokenEndpointPassthrough()
.DisableTransportSecurityRequirement();
})
.AddValidation(o =>
{
o.UseLocalServer();
o.UseAspNetCore();
});
并测试应用描述:
var descriptor = new OpenIddictApplicationDescriptor
{
ClientId = "test-app",
DisplayName = "Test Application",
PostLogoutRedirectUris = { new Uri("https://oidcdebugger.com/debug") },
RedirectUris = { new Uri("https://oidcdebugger.com/debug") }
};
我正在使用OpenID Connect debugger 进行测试。
【问题讨论】:
标签: c# asp.net-core openid-connect openiddict