HTTP 重定向绑定 SAML 请求

问题描述 投票:0回答:2

假设进行SP-init SSO,使用HTTP-Redirect Binding代替HTTP-POST Binding,并且需要签名的AuthnRequest。这意味着在 URL 中包含 SAMLRequest。

Q1。我需要在 URL 中包含签名还是仅嵌入 SAMLRequest 中?

重定向网址是

http://idp.example.com/SSOService.php?SAMLRequest={val1}&Signature={val2}&SigAlg={val3}

使用我的 SAMLRequest(无签名)

<samlp:AuthnRequest ID="" Version="2.0" IssueInstant="2015-05-22T02:47:38Z" Destination="" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"></saml:Issuer>
    <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" AllowCreate="true" />
    <samlp:RequestedAuthnContext Comparison="exact" />
    <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</samlp:AuthnRequest>

http://idp.example.com/SSOService.php?SAMLRequest={val1}

使用我的 SAMLRequest(嵌入签名)

<samlp:AuthnRequest ID="" Version="2.0" IssueInstant="2015-05-22T02:47:38Z" Destination="" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"></saml:Issuer>
    <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" AllowCreate="true" />
    <samlp:RequestedAuthnContext Comparison="exact" />
    <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
            <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
            <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
            <Reference URI="">
                <Transforms>
                    <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                </Transforms>
                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                <DigestValue>v5h...</DigestValue>
            </Reference>
        </SignedInfo>
        <SignatureValue>M4...</SignatureValue>
    </Signature>
</samlp:AuthnRequest>

Q2。对url参数的值进行base64和url编码是否正确?

Q3。 X509 证书包含在我的 SP 元数据中,它是 base64 编码的吗?

我有一个证书的 cert.pem 文件,我需要对其进行 Base64 编码还是直接包含证书。

-----BEGIN CERTIFICATE-----
MII...
-----END CERTIFICATE-----

SP元数据.xml

<KeyDescriptor use="signing">
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:X509Data>
                    <ds:X509Certificate>MIIFnzCCA4egAwI...</ds:X509Certificate>
                </ds:X509Data>
            </ds:KeyInfo>
        </KeyDescriptor>
single-sign-on x509certificate saml-2.0
2个回答
8
投票

A1:使用重定向绑定时,您将签名放在 URL 查询参数中

A2:所有 URL 查询参数都应进行 url 编码,除此之外,仅 SAML 请求应进行压缩和 Base64 编码。

A3:使用 PEM 格式,因为它已经进行了 Base64 编码,但省略了开始和结束分隔符(----BEGIN-- 和 ----END CERT...)


0
投票

那么 SAML 请求/响应在附加到 URL 之前会被缩减、编码 (Base64) 和查询编码?

@汉兹

© www.soinside.com 2019 - 2024. All rights reserved.