【发布时间】:2018-09-07 16:02:15
【问题描述】:
我正在从事 SP 方面的工作。我们收到了来自 IDP 的 SAML2 响应。
看起来有点像这里的例子:
SAML: Why is the certificate within the Signature?
现在我正在使用 OpenSaml2 来解析和处理这个 xml 文件中的内容。
我需要从响应中提取证书并将其用作凭据。
到目前为止,我已经这样做了:
Response response = (Response) xmlObject;
SAMLSignatureProfileValidator profileValidator = new
SAMLSignatureProfileValidator();
Signature signature = response.getSignature();
Credential credential = null;
profileValidator.validate(signature);
SignatureValidator validator = new SignatureValidator(credential);
validator.validate(signature);
在上面的代码中,凭证暂时为“null”,但我需要它是证书中的公钥。知道我该怎么做吗?
听说 opensaml2 有 KeyInfoCredentialResolver 等方法可以帮助解决这个问题,但还没有看到一个简单的实现。
【问题讨论】:
标签: java xml saml saml-2.0 opensaml