2

我使用 Okta 作为身份提供者。在 MVC 应用程序中实现了 Owin 中间件。在使用 SAML2 作为协议的 Okta 中注册应用程序后,尝试使用 Kentor.Authservices 从 Owin 中间件连接到 okta。我没有使用身份 server3。

    var authServicesOktaOptions = new KentorAuthServicesAuthenticationOptions(false)
    {
         SPOptions = new SPOptions
         {
               AuthenticateRequestSigningBehavior = SigningBehavior.Never,
               EntityId = new EntityId("http://core/Account/ExternalLoginCallback"),
                        ReturnUrl = new Uri("http://core/Account/ExternalLoginCallback"),
                    },
                    AuthenticationType = "Login With <CompanyName>",
                    Caption = "Login With <CompanyName>",
                };

                var idpOkta = new IdentityProvider(new EntityId("http://www.okta.com/exk2bm6xe5eT3jQkN1t6"), authServicesOktaOptions.SPOptions)
                {
                    LoadMetadata = true,
                    MetadataLocation = "https://<companyname>.okta.com/app/exk2bm6xe5eT3jQkN1t6/sso/saml/metadata",
                    Binding = Saml2BindingType.HttpRedirect,
                    AllowUnsolicitedAuthnResponse = true,
                    SingleSignOnServiceUrl = new Uri("https://<companyname>.okta.com/app/<companyname>_test<appname>withokta_1/exk2bm6xe5eT3jQkN1t6/sso/saml"),
                };

    authServicesOktaOptions.IdentityProviders.Add(idpOkta);
    app.UseKentorAuthServicesAuthentication(authServicesOktaOptions);

在 ExternalCallback 函数的控制器中,我期待 userLoginInfo 详细信息

[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
   var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
}

但是 loginIfo 总是为空。

4

0 回答 0