use of org.apache.hadoop.ozone.om.protocol.S3Auth in project ozone by apache.
the class OzoneClientProducer method getSignature.
@Produces
public S3Auth getSignature() {
try {
SignatureInfo signatureInfo = signatureProcessor.parseSignature();
String stringToSign = "";
if (signatureInfo.getVersion() == Version.V4) {
stringToSign = StringToSignProducer.createSignatureBase(signatureInfo, context);
}
String awsAccessId = signatureInfo.getAwsAccessId();
// ONLY validate aws access id when needed.
if (awsAccessId == null || awsAccessId.equals("")) {
LOG.debug("Malformed s3 header. awsAccessID: {}", awsAccessId);
throw ACCESS_DENIED;
}
return new S3Auth(stringToSign, signatureInfo.getSignature(), awsAccessId);
} catch (OS3Exception ex) {
LOG.debug("Error during Client Creation: ", ex);
throw wrapOS3Exception(ex);
} catch (Exception e) {
// For any other critical errors during object creation throw Internal
// error.
LOG.debug("Error during Client Creation: ", e);
throw wrapOS3Exception(S3ErrorTable.newError(INTERNAL_ERROR, null, e));
}
}
Aggregations