Kentor/Owin/Azure 广告认证
Kentor/Owin/Azure AD Authentication
我有一个 Web 表单应用程序,我正在尝试使用 SAML 2/Kentor/Owin 对 Azure AD 进行身份验证。我 认为 我已经配置好了,但是当我的登录页面发出以下命令时,我没有被重定向到登录页面。
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/Login.aspx" });
这是我的 startup.cs
private void ConfigureSAML2Authentication(IAppBuilder app) {
var authServicesOptions = new KentorAuthServicesAuthenticationOptions(false)
{
SPOptions = new SPOptions
{
EntityId = new EntityId("https://login.microsoftonline.com/<tenant guid>/saml2")
}
},
AuthenticationType = "KentorAuthServices",
Caption = "ADFS - SAML2p",
};
authServicesOptions.IdentityProviders.Add(new IdentityProvider(
new EntityId("https://sts.windows.net/<tenant guid>/"),
authServicesOptions.SPOptions)
{
MetadataLocation = "https://login.microsoftonline.com/<tenant guid>/federationmetadata/2007-06/federationmetadata.xml",
LoadMetadata = true,
});
app.UseKentorAuthServicesAuthentication(authServicesOptions);
}
据我所知,查看 chrome 中的网络工具,根本没有发送任何身份验证请求。谁能告诉我为什么?
AuthServices 中间件默认配置为被动,因此除非您指定提供程序,否则它不会自动响应身份验证质询。
发出质询时,您应该指定与设置中间件时使用的相同的 AuthenticationType。默认情况下,这是 "KentorAuthServices",但可以更改。
如果您更改质询以包含类型,它应该会触发重定向:
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/Login.aspx" }, "KentorAuthServices");
我有一个 Web 表单应用程序,我正在尝试使用 SAML 2/Kentor/Owin 对 Azure AD 进行身份验证。我 认为 我已经配置好了,但是当我的登录页面发出以下命令时,我没有被重定向到登录页面。
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/Login.aspx" });
这是我的 startup.cs
private void ConfigureSAML2Authentication(IAppBuilder app) {
var authServicesOptions = new KentorAuthServicesAuthenticationOptions(false)
{
SPOptions = new SPOptions
{
EntityId = new EntityId("https://login.microsoftonline.com/<tenant guid>/saml2")
}
},
AuthenticationType = "KentorAuthServices",
Caption = "ADFS - SAML2p",
};
authServicesOptions.IdentityProviders.Add(new IdentityProvider(
new EntityId("https://sts.windows.net/<tenant guid>/"),
authServicesOptions.SPOptions)
{
MetadataLocation = "https://login.microsoftonline.com/<tenant guid>/federationmetadata/2007-06/federationmetadata.xml",
LoadMetadata = true,
});
app.UseKentorAuthServicesAuthentication(authServicesOptions);
}
据我所知,查看 chrome 中的网络工具,根本没有发送任何身份验证请求。谁能告诉我为什么?
AuthServices 中间件默认配置为被动,因此除非您指定提供程序,否则它不会自动响应身份验证质询。
发出质询时,您应该指定与设置中间件时使用的相同的 AuthenticationType。默认情况下,这是 "KentorAuthServices",但可以更改。
如果您更改质询以包含类型,它应该会触发重定向:
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/Login.aspx" }, "KentorAuthServices");