use of org.apache.cxf.rs.security.httpsignature.exception.DifferentAlgorithmsException in project cxf by apache.
the class TomitribeSignatureValidator method validate.
@Override
public void validate(Map<String, List<String>> messageHeaders, AlgorithmProvider algorithmProvider, KeyProvider keyProvider, SecurityProvider securityProvider, String method, String uri, List<String> requiredHeaders) {
Signature signature = extractSignatureFromHeader(messageHeaders.get("Signature").get(0));
String providedAlgorithm = algorithmProvider.getAlgorithmName(signature.getKeyId());
String signatureAlgorithm = signature.getAlgorithm().toString();
if (!providedAlgorithm.equals(signatureAlgorithm)) {
throw new DifferentAlgorithmsException("signature algorithm from header and provided are different");
}
Key key = keyProvider.getKey(signature.getKeyId());
java.security.Provider provider = securityProvider != null ? securityProvider.getProvider(signature.getKeyId()) : null;
runVerifier(messageHeaders, key, signature, provider, method, uri, requiredHeaders);
}
Aggregations