7

我正在集成 SustainSys.Saml2,Gluu 服务器作为我的 IdP。我正在使用开箱即用的脚手架身份页面。当我在 localhost 中运行并查看控制台日志时,一切似乎都与 SAML 通信一起工作,我什至看到几行内容如下:

Sustainsys.Saml2.AspNetCore2.Saml2Handler[0]
Successfully processed SAML response Microsoft.IdentityModel.Tokens.Saml2.Saml2Id and authenticated
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler[10]
AuthenticationScheme: Identity.External signed in.

除非我弄错了,否则这表明 SAML 端的一切都很好。但我不明白的是为什么,在ExternalLogin.OnGetCallbackAsync,命令

var info = await _signInManager.GetExternalLoginInfoAsync();

发现info设置为null

作为记录,在 Startup.cs 中,我有:

services.AddAuthentication()
  .AddSaml2(options =>
  {
    options.SPOptions.EntityId = new EntityId("{entityId}");
    options.IdentityProviders.Add(
      new IdentityProvider(new EntityId("{entityId}"), options.SPOptions)
      {
        Metadatalocation = "{metadataURL}",
      });
    options.Validate();
  });
4

1 回答 1

3

我能够根据这个 GitHub 问题和安德斯的笔记来解决这个问题。

我会在那里链接到我的评论。阅读上面安德斯的评论以获得解释。https://github.com/Sustainsys/Saml2/issues/1030#issuecomment-616842796

于 2020-04-21T01:41:03.840 回答