本文整理汇总了Java中org.opensaml.xmlsec.signature.support.SignatureValidator类的典型用法代码示例。如果您正苦于以下问题:Java SignatureValidator类的具体用法?Java SignatureValidator怎么用?Java SignatureValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SignatureValidator类属于org.opensaml.xmlsec.signature.support包,在下文中一共展示了SignatureValidator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateSignatureOnProfileRequest
import org.opensaml.xmlsec.signature.support.SignatureValidator; //导入依赖的package包/类
private void validateSignatureOnProfileRequest(final RequestAbstractType profileRequest,
final Signature signature,
final RoleDescriptorResolver roleDescriptorResolver) throws Exception {
final SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator();
LOGGER.debug("Validating profile signature for [{}] via [{}]...", profileRequest.getIssuer(),
validator.getClass().getSimpleName());
validator.validate(signature);
LOGGER.debug("Successfully validated profile signature for [{}].", profileRequest.getIssuer());
final Credential credential = getSigningCredential(roleDescriptorResolver, profileRequest);
if (credential == null) {
throw new SamlException("Signing credential for validation could not be resolved");
}
LOGGER.debug("Validating signature using credentials for [{}]", credential.getEntityId());
SignatureValidator.validate(signature, credential);
LOGGER.info("Successfully validated the request signature.");
}
示例2: verifyAssertionSignature
import org.opensaml.xmlsec.signature.support.SignatureValidator; //导入依赖的package包/类
private void verifyAssertionSignature(Assertion assertion) {
if (!assertion.isSigned()) {
throw new RuntimeException("The SAML Assertion was not signed");
}
try {
SAMLSignatureProfileValidator profileValidator = new SAMLSignatureProfileValidator();
profileValidator.validate(assertion.getSignature());
SignatureValidator.validate(assertion.getSignature(), IDPCredentials.getCredential());
logger.info("SAML Assertion signature verified");
} catch (SignatureException e) {
e.printStackTrace();
}
}