Search in sources :

Example 1 with S3Auth

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));
    }
}
Also used : SignatureInfo(org.apache.hadoop.ozone.s3.signature.SignatureInfo) S3Auth(org.apache.hadoop.ozone.om.protocol.S3Auth) OS3Exception(org.apache.hadoop.ozone.s3.exception.OS3Exception) OS3Exception(org.apache.hadoop.ozone.s3.exception.OS3Exception) IOException(java.io.IOException) WebApplicationException(javax.ws.rs.WebApplicationException) Produces(javax.enterprise.inject.Produces)

Aggregations

IOException (java.io.IOException)1 Produces (javax.enterprise.inject.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 S3Auth (org.apache.hadoop.ozone.om.protocol.S3Auth)1 OS3Exception (org.apache.hadoop.ozone.s3.exception.OS3Exception)1 SignatureInfo (org.apache.hadoop.ozone.s3.signature.SignatureInfo)1