gpt4 book ai didi

azure - Kentor/Owin/Azure AD 身份验证

转载 作者:行者123 更新时间:2023-12-02 06:47:19 25 4
gpt4 key购买 nike

我有一个 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");

关于azure - Kentor/Owin/Azure AD 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47194409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com