Asp.net-Core-2.0
使用 SAML 2.0 作為 SSO 的外部身份提供者的身份伺服器 4
我正在使用身份伺服器 4 對我的 ASP.Net Core 解決方案進行身份驗證。它與 Facebook、Google 和其他外部身份提供商合作良好。現在我正在嘗試使用來自<https://github.com/Sustainsys/Saml2>的 Sustainsys.Saml2 將 SAML 2.0 身份驗證添加到身份伺服器,並使其作為外部身份提供者工作。(我們網站的客戶希望使用我們的身份伺服器使用他們的 SAML 身份提供者登錄,就像他們可以通過 Facebook、Google 等登錄一樣)
而我現在擁有的是
- 登錄網址 - <https://sso.domain.com/saml/idp/profile/redirectorpost/sso>
- 退出 URL - <https://sso.domain.com/saml/idp/profile/post/sls>
- 我們客戶的基於 SAML 的身份提供者的 CRT 證書。
但是,我在身份伺服器 4 startup.cs 文件中找不到描述如何設置 SAML 2.0 配置的文件。我認為配置應如下所示,基於可用的範例: https ://github.com/Sustainsys/Saml2/blob/master/Samples/SampleAspNetCore2ApplicationNETFramework/Startup.cs
services.AddAuthentication() .AddSaml2(options => { options.SPOptions.EntityId = new EntityId("..."); options.IdentityProviders.Add( new IdentityProvider( new EntityId("..."), options.SPOptions) { LoadMetadata = true, }); options.SPOptions.ServiceCertificates.Add(new X509Certificate2("...")); } );在範例中有兩個 url
- <https://localhost:44342/Saml2>
- http://localhost:52071/元數據
這些代表什麼?
有人可以告訴我如何在身份伺服器 4 中設置 SAML2 的所有選項嗎?
- 是您的應用程序的實體 id - 對應於 open id connect 中的客戶端 id。
- 是上游 idp 的實體 id。
在另一個分支中有一個範例 IdSrv4:https ://github.com/Sustainsys/Saml2/tree/netstandard/Samples/SampleIdentityServer4
該範例使用 .NET Core 的預覽版,但配置基本相同。<https://github.com/Sustainsys/Saml2/tree/master/Samples>中有工作的 IdentityServer4 範例