簡體   English   中英

如何配置我的 SAML 服務提供商以將元數據發送到身份提供商?

[英]How do I configure my SAML Service Provider to send metadata to the Identity Provider?

我在 my.Net Web API 項目中使用 ITfoxTec SAML 庫。

我讓它與名為 Okta 的 SAML 身份提供商測試服務一起使用,並且運行良好。

但現在我需要使用更復雜的企業 SAML 身份提供者。

我需要發送元數據,所以我使用了其中一個在線 SAML 元數據生成器並得到了這個:

<?xml version="1.0"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
                     validUntil="2023-02-03T18:10:14Z"
                     cacheDuration="PT604800S"
                     entityID="54ab9813-9546-4630-90eb-f31f69fbe535">
    <md:SPSSODescriptor AuthnRequestsSigned="true" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
        <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>
        <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                                     Location="https://portal.xyz.com/claims"
                                     index="1" />
        
    </md:SPSSODescriptor>
</md:EntityDescriptor>

我在我的站點上提供了元數據 XML 文件:

https://portal.xyz.com/public/5001_Saml2.xml

但是,當我嘗試連接到 SAML IdP 時,我在控制台中收到此錯誤:

發生 System.InvalidOperationException HResult=0x80131509 Message=Incorrect Content-Type

我的應用程序用來連接到 IdP 的 controller 在這里:

[Route("Login")]
public IActionResult Login(string? returnUrl = null)
{
    var binding = new Saml2RedirectBinding();
    binding.SetRelayStateQuery(new Dictionary<string, string> { { relayStateReturnUrl, returnUrl ?? Url.Content("~/") } });

    return binding.Bind(new Saml2AuthnRequest(config)).ToActionResult();
}

我不確定我做錯了什么,有誰知道如何為 ITfoxTec SAML 2.0 設置這樣的元數據?

謝謝!

您應該讓 ITfoxtec Identity SAML libery 創建在線元數據,然后它應該可以工作。

例如,您可以在TestWebAppCore 示例中找到元數據生成示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM