asp.net-core - 在 ASP.NET Core 中,为什么 AddOpenIdConnect 没有 AuthorizationEndpoint 作为选项,就像 AddoAuth 一样?
问题描述
OIDC 所需的授权端点。然而,AddOpenIDConnect 没有 AddOAuth 的 AuthorizationEndpoint 选项。
解决方案
OpenID Connect 处理程序通常使用特殊的“发现”端点来查找授权端点(除其他外)。它需要您的授权并将“/.well-known/openid-configuration”附加到它以获取元数据。
从那里它authorization_endpoint
从 JSON 中获取。
例如,将权限设置为https://login.microsoftonline.com/common/v2.0
(Azure AD) 将从https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration获取元数据。
{
"authorization_endpoint":"https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
}
请注意,这是处理程序在默认情况下以最少的配置执行的操作。您可以手动设置MetadataAddress
而不是设置发现端点 URL。Authority
如果您根本不想使用发现端点,您可以Configuration
手动提供该属性:
o.Configuration = new Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfiguration
{
// Other properties omitted
AuthorizationEndpoint = ""
};
推荐阅读
- php - 为什么我无法在每个模态中获取标题和注释?
- jquery - revokeObjectURL 在 mozilla firefox 和 Microsoft Edge 中不起作用
- android - 将 Int 绑定到 TextView 时的 ResourcesNotFoundException
- regex - 将 logstash 中的字段与“$”匹配
- google-cloud-speech - Speech to Text rest API 很慢。如何改进?
- r - 通过终端在 Rstudio 中执行 Wolframscript 代码
- asp.net-core - 如何从 ASPNETCORE 2.2 应用程序中的 AuthorizationAttribute 获取用户?
- c++ - 将枚举转换为值的正确方法
- virtualbox - 尽管成功安装来宾添加,但 CentOS7 VirtualBox 中的分辨率有限
- javascript - 为什么我们在使用 babel-loader 时要排除 node_modules?