.NET Framework OpenIdConnect 包中缺少 OnRedirectToIdentityProvider 事件
OnRedirectToIdentityProvider event missing in .NET Framework OpenIdConnect package
在 Microsoft.AspNetCore.Authentication.OpenIdConnect 包中,OpenIdConnectEvents class 中有许多事件,尤其是 OnRedirectToIdentityProvider(Microsoft docs) 但对于 .NET Framework我们有 Microsoft.Owin.Security.OpenIdConnect 包,我在其中找不到任何这些事件。有人知道是否可以在 .NET Framework 中获得此类功能吗?
我们使用身份服务器 4 进行身份验证,并使用 .NET Framework 4.7.2 mvc 客户端。我的目标是连接到最终用户被重定向到授权机构以进行身份验证的地方(在客户端上)。
您可以在 Microsoft.Owin.Security.OpenIdConnect
中使用 OpenIdConnectAuthenticationNotifications class :
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = "https://localhost:44319/identity",
ClientId = "mvc",
Scope = "openid profile roles sampleApi",
ResponseType = "id_token token",
RedirectUri = "https://localhost:44319/",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = false,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = async n =>
{
},
RedirectToIdentityProvider = n =>
{
return Task.FromResult(0);
}
}
});
在 Microsoft.AspNetCore.Authentication.OpenIdConnect 包中,OpenIdConnectEvents class 中有许多事件,尤其是 OnRedirectToIdentityProvider(Microsoft docs) 但对于 .NET Framework我们有 Microsoft.Owin.Security.OpenIdConnect 包,我在其中找不到任何这些事件。有人知道是否可以在 .NET Framework 中获得此类功能吗?
我们使用身份服务器 4 进行身份验证,并使用 .NET Framework 4.7.2 mvc 客户端。我的目标是连接到最终用户被重定向到授权机构以进行身份验证的地方(在客户端上)。
您可以在 Microsoft.Owin.Security.OpenIdConnect
中使用 OpenIdConnectAuthenticationNotifications class :
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = "https://localhost:44319/identity",
ClientId = "mvc",
Scope = "openid profile roles sampleApi",
ResponseType = "id_token token",
RedirectUri = "https://localhost:44319/",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = false,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = async n =>
{
},
RedirectToIdentityProvider = n =>
{
return Task.FromResult(0);
}
}
});