Kentor.Authservices - GetExternalLoginInfoAsync返回null

时间:2016-08-03 15:41:01

标签: asp.net-mvc owin saml-2.0 okta kentor-authservices

我使用Okta作为身份提供者。在MVC中实现了Owin中间件     应用。在Okta中注册应用程序后,使用SAML2作为     协议,尝试使用从Owin中间件连接到okta     Kentor.Authservices。我没有使用身份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函数的Controller中,我期待userLoginInfo详细信息

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

但是loginIfo总是为空。

0 个答案:

没有答案