ruby-saml gem支持将证书和私钥信息添加到服务提供商的元数据中,但据我所知,它仅配置签名证书,而不配置加密证书。这是我的工作:
settings.certificate = "---- BEGIN CERTIFICATE----..."
settings.private_key = "-----BEGIN PRIVATE KEY----..."
这将导致以下XML部分添加到服务提供商的元数据:
<md:KeyDescriptor use='signing'>
<ds:KeyInfo xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>
<ds:X509Data>
<ds:X509Certificate>
CERTIFICATE IS HERE GSDk3tShjl4yhShj4Hr....
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
但是我如何配置ruby-saml为use ='encryption'添加一个类似的部分,而不是'signing'?
如果我理解正确,您将无法以加密形式发送SAMLResponse。如果是这种情况,则在构建SAML响应时,再发送一个参数
saml_response = encode_response( :encryption => encryption_opts())
def encryption_opts:
return {
cert: saml_request.service_provider.cert,
block_encryption: 'aes256-cbc',
key_transport: 'rsa-oaep-mgf1p'
}