我有一个问题要做样品,这将实现RFC-7522。我拥有的是IdentityServer4 (v2.2.0)作为oAuth 授权服务器(.NET Core2.0,Console Application)和不同的SAML2 IdP。现在,我想使用Saml断言来引导用户。
作为灵感,我使用了这个视频,其中Brock和Dominick描述了如何设置SAML2处理程序。
但遗憾的是,我一开始就被困在了我想要将代码片段粘贴到代码中的地方,每次我都会遇到不同的编译错误(取决于我使用的努基特 )。不幸的是我没能解决这些问题。
蛇头:
//IServiceCollection services
services.AddAuthentication().AddSaml2(options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SPOptions.EntityId = new Saml2NameIdentifier(samlIdentityUrl);
var idp = new IdentityProvider(new EntityId(samlMetadataUrl), options.SPOptions)
{
SingleSignOnServiceUrl = new Uri(samlSignOnUrl),
Binding = Saml2BindingType.HttpRedirect
};
idp.SigningKeys.AddConfiguredKey(new X509Certificate2(certificate));
options.IdentityProviders.Add(idp);
});
普通营养品:
场景#1:可持续性.Saml2.AspNetCore2 (0.24.0)
使用'.NetFramework,Version=v4.6.1‘恢复了包“可持续性”。这和这问题中提到的是什么。最重要的是,我几乎没有编译错误,可以中断到,类型'EntityId‘和'SecurityKeyIdentifierClause’是在没有引用的程序集中定义的。
场景#2:可持续性.Saml2.AspNetCore2(2.0.0-预览01)
缺少整个Sustainsys命名空间,它被Kentor.AuthServices替换。参考.AddSaml2(..)未找到。
发布于 2018-08-03 07:17:41
好吧,我通过更新nugets解决了我的问题,并将导入到以下状态:
Nuget:
导入:
using Microsoft.IdentityModel.Tokens.Saml2;
using Kentor.AuthServices;
using Kentor.AuthServices.Metadata;
using Kentor.AuthServices.WebSso;
https://stackoverflow.com/questions/51650824
复制相似问题