layout: docs-default
概述
IdentityServer3支持WS-Federation协议,可以作为认证方或者第三方认证的使用方。
如果要集成IdentityServer和第三方 WS-Federation 身份认证, 如: ADFS,请看Identity Providers section of the documentation.
本节将在IdentityServer3中增加WS-Federation认证方功能。
安装
WS-Federation支持是IdentityServer3中的一个插件,首先需要通过Nuget安装:
install-package IdentityServer3.WsFederation
这个插件需要配置IdentityServerOptions
上的PluginConfiguration
回调:
public void Configuration(IAppBuilder appBuilder)
{
var options = new IdentityServerOptions
{
SiteName = "IdentityServer3 with WsFed",
SigningCertificate = Certificate.Get(),
Factory = factory,
PluginConfiguration = ConfigureWsFederation
};
appBuilder.UseIdentityServer(options);
}
private void ConfigureWsFederation(IAppBuilder pluginApp, IdentityServerOptions options)
{
var factory = new WsFederationServiceFactory(options.Factory);
factory.UseInMemoryRelyingParties(RelyingParties.Get());
var wsFedOptions = new WsFederationPluginOptions
{
IdentityServerOptions = options,
Factory = factory
};
pluginApp.UseWsFederationPlugin(wsFedOptions);
}
WS-Federation插件需要在ServericFactory中注册。这个例子中,我们注册了依赖的第三方列表并且实现了IRelyingPartyService
(和other in-memory services and stores差不多).
IRelyingPartyService
是唯一必须实现的服务.
一个依赖第三方在WS-Federation中等同于 OpenId Connect 或者 OAuth2 client.
请看 这里 了解更多.
网友评论