假设执行了SP-init SSO,则使用HTTP重定向绑定(bind)而不是HTTP-POST绑定(bind),并且需要签名的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。将base64和url编码为url参数的值是否正确?

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

我有一个用于证书的cert.pem文件,我需要将其设置为base64编码还是直接包含该证书。
-----BEGIN CERTIFICATE-----
MII...
-----END CERTIFICATE-----

SPMetadata.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>

最佳答案

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

解答2:所有URL查询参数均应进行url编码,除此之外,仅应压缩SAML请求并对其进行base64编码。

A3:使用PEM格式,因为该格式已经是base64编码的,但是省略了开始和结束定界符(---- BEGIN--和---- END CERT ...)

关于single-sign-on - HTTP重定向绑定(bind)SAML请求,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30388926/

10-09 00:40
查看更多