我正在集成 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();
});