use*_*099 5 asp.net-mvc openid-connect asp.net-core
我正在尝试实现对我的 .net core 2.0 站点的 OpenIdConnect 登录。我尝试使用的 IdentityServer 仅支持“client_secret_basic”作为 token_endpoint_auth_methods。我按如下方式配置应用程序:
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = "Cookies";
options.DefaultSignInScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.SignInScheme = "Cookies";
options.Authority = Auhtority;
options.ClientId = ClientID;
options.ClientSecret = ClientSecret;
options.ResponseType = "code";
options.SaveTokens = true;
options.Scope.Add("profile");
options.Scope.Add("rrn");
});
Run Code Online (Sandbox Code Playgroud)
但这似乎将 ClientId 和 ClientSecret 发布到请求正文中,而不是使用 HTTP 基本身份验证。我可能错过了一些明显的东西,但我似乎找不到如何配置 OpenIdConnect 以使用 client_secret_basic 而不是 client_secret_post。有任何想法吗?
我遇到了同样的问题,我终于使用以下选项/事件挂钩让它工作using System.Net.Http;:
options.Events.OnAuthorizationCodeReceived = context =>
{
context.Backchannel.SetBasicAuthenticationOAuth(context.TokenEndpointRequest.ClientId, context.TokenEndpointRequest.ClientSecret);
return Task.CompletedTask;
};
Run Code Online (Sandbox Code Playgroud)
我主要是从对您的问题的评论中得到这一点,并且提到的方法被标记为已弃用,并提示我使用的新扩展方法。
注意:SetBasicAuthenticationOAuth 是 IdentityModel nuget 中 HttpClient 的扩展
| 归档时间: |
|
| 查看次数: |
1843 次 |
| 最近记录: |