Package org.jets3t.service.utils.gatekeeper

Examples of org.jets3t.service.utils.gatekeeper.SignatureRequest


            for (int i = 0; i < objects.length; i++) {
                String signedPutUrl = S3Service.createSignedPutUrl(s3BucketName, objects[i].getKey(),
                    objects[i].getMetadataMap(), awsCredentials, expiryDate, false);
               
                SignatureRequest signatureRequest = new SignatureRequest(
                    SignatureRequest.SIGNATURE_TYPE_PUT, objects[i].getKey());
                signatureRequest.setBucketName(s3BucketName);
                signatureRequest.setObjectMetadata(objects[i].getMetadataMap());
                signatureRequest.signRequest(signedPutUrl);
               
                gatekeeperMessage.addSignatureRequest(signatureRequest);               
            }
                       
            return gatekeeperMessage;
View Full Code Here


            priorFailureException = null;
        }
       
        // Add all S3 objects as candiates for PUT signing.
        for (int i = 0; i < objects.length; i++) {
            SignatureRequest signatureRequest = new SignatureRequest(
                SignatureRequest.SIGNATURE_TYPE_PUT, objects[i].getKey());
            signatureRequest.setObjectMetadata(objects[i].getMetadataMap());
           
            gatekeeperMessage.addSignatureRequest(signatureRequest);
        }
       
       
View Full Code Here

    {
        List signedObjects = new ArrayList();
        String firstDeclineReason = null;
       
        for (int i = 0; i < signatureRequests.length; i++) {
            SignatureRequest request = signatureRequests[i];
            S3Object object = objects[i];
           
            // Store summary information in XML document generator.
            if (xmlGenerator != null) {
                Map clonedMetadata = new HashMap();
                clonedMetadata.putAll(object.getMetadataMap());
                xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(),
                    clonedMetadata, request);
            }

            if (request.isSigned()) {
                // Update object with any changes dictated by Gatekeeper.
                if (request.getObjectKey() != null) {
                    object.setKey(request.getObjectKey());
                }
                if (request.getBucketName() != null) {
                    object.setBucketName(request.getBucketName());
                }
                if (request.getObjectMetadata() != null && request.getObjectMetadata().size() > 0) {
                    object.replaceAllMetadata(request.getObjectMetadata());
                }
               
                SignedUrlAndObject urlAndObject = new SignedUrlAndObject(request.getSignedUrl(), object);
                signedObjects.add(urlAndObject);
            } else {
                // If ANY requests are declined, we will fail with a fatal error message.
                String declineReason = (request.getDeclineReason() == null
                    ? "Unknown"
                    : request.getDeclineReason());
                log.warn("Upload of '" + objects[i].getKey() + "' was declined for reason: "
                    + declineReason);
                if (firstDeclineReason == null) {
                    firstDeclineReason = declineReason;
                }
View Full Code Here

            } else {           
              log.debug("Processing " + gatekeeperMessage.getSignatureRequests().length
                  + " object signature requests");
              // Process each signature request.
              for (int i = 0; i < gatekeeperMessage.getSignatureRequests().length; i++) {
                  SignatureRequest signatureRequest = (SignatureRequest) gatekeeperMessage.getSignatureRequests()[i];
                 
                  // Determine whether the request will be allowed. If the request is not allowed, the
                  // reason will be made available in the signature request object (with signatureRequest.declineRequest())
                  boolean allowed = authorizer.allowSignatureRequest(gatekeeperMessage, clientInformation, signatureRequest);
 
                  // Sign requests when they are allowed. When a request is signed, the signed URL is made available
                  // in the SignatureRequest object.
                  if (allowed) {
                      String signedUrl = null;
                      if (SignatureRequest.SIGNATURE_TYPE_GET.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signGet(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_HEAD.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signHead(gatekeeperMessage, clientInformation, signatureRequest);
                      } else if (SignatureRequest.SIGNATURE_TYPE_PUT.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signPut(gatekeeperMessage, clientInformation, signatureRequest);
                      } else if (SignatureRequest.SIGNATURE_TYPE_DELETE.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signDelete(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_ACL_LOOKUP.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signGetAcl(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_ACL_UPDATE.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signPutAcl(gatekeeperMessage, clientInformation, signatureRequest);                       
                      }
                      signatureRequest.signRequest(signedUrl);
                  }                
              }
            }
                       
            // Build response as a set of properties, and return this document.
View Full Code Here

      S3Object[] objects = service.listObjects(s3BucketName, prefix, null, 1000);
       
        // Package object information in SignatureRequest objects. This data will be
        // automatically encoded and sent across the wire back to the client.
      for (int i = 0; i < objects.length; i++) {
        SignatureRequest sr = new SignatureRequest();
            sr.setObjectMetadata(objects[i].getMetadataMap());
            sr.addObjectMetadata(S3Object.METADATA_HEADER_LAST_MODIFIED_DATE,
                ServiceUtils.formatIso8601Date(objects[i].getLastModifiedDate()));
            sr.setObjectKey(objects[i].getKey());
        gatekeeperMessage.addSignatureRequest(sr);
      }
       
        gatekeeperMessage.addApplicationProperty("AccountDescription",
            "<html>Bucket: <b>" + s3BucketName + "</b></html>");
View Full Code Here

                  log.debug("Processing " + gatekeeperMessage.getSignatureRequests().length
                      + " object signature requests");
                }
              // Process each signature request.
              for (int i = 0; i < gatekeeperMessage.getSignatureRequests().length; i++) {
                  SignatureRequest signatureRequest = (SignatureRequest) gatekeeperMessage.getSignatureRequests()[i];
                 
                  // Determine whether the request will be allowed. If the request is not allowed, the
                  // reason will be made available in the signature request object (with signatureRequest.declineRequest())
                  boolean allowed = authorizer.allowSignatureRequest(gatekeeperMessage, clientInformation, signatureRequest);
 
                  // Sign requests when they are allowed. When a request is signed, the signed URL is made available
                  // in the SignatureRequest object.
                  if (allowed) {
                      String signedUrl = null;
                      if (SignatureRequest.SIGNATURE_TYPE_GET.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signGet(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_HEAD.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signHead(gatekeeperMessage, clientInformation, signatureRequest);
                      } else if (SignatureRequest.SIGNATURE_TYPE_PUT.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signPut(gatekeeperMessage, clientInformation, signatureRequest);
                      } else if (SignatureRequest.SIGNATURE_TYPE_DELETE.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signDelete(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_ACL_LOOKUP.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signGetAcl(gatekeeperMessage, clientInformation, signatureRequest);                       
                      } else if (SignatureRequest.SIGNATURE_TYPE_ACL_UPDATE.equals(signatureRequest.getSignatureType())) {
                          signedUrl = urlSigner.signPutAcl(gatekeeperMessage, clientInformation, signatureRequest);                       
                      }
                      signatureRequest.signRequest(signedUrl);
                  }                
              }
            }
                       
            // Build response as a set of properties, and return this document.
View Full Code Here

            priorFailureException = null;
        }
       
        // Add all S3 objects as candiates for PUT signing.
        for (int i = 0; i < objects.length; i++) {
            SignatureRequest signatureRequest = new SignatureRequest(
                operationType, objects[i].getKey());
            signatureRequest.setObjectMetadata(objects[i].getMetadataMap());
            signatureRequest.setBucketName(bucketName);
           
            gatekeeperMessage.addSignatureRequest(signatureRequest);
        }
               
        /*
 
View Full Code Here

            for (int i = 0; i < objects.length; i++) {
                String signedPutUrl = S3Service.createSignedPutUrl(s3BucketName, objects[i].getKey(),
                    objects[i].getMetadataMap(), awsCredentials, expiryDate, false);
               
                SignatureRequest signatureRequest = new SignatureRequest(
                    SignatureRequest.SIGNATURE_TYPE_PUT, objects[i].getKey());
                signatureRequest.setBucketName(s3BucketName);
                signatureRequest.setObjectMetadata(objects[i].getMetadataMap());
                signatureRequest.signRequest(signedPutUrl);
               
                gatekeeperMessage.addSignatureRequest(signatureRequest);               
            }
                       
            return gatekeeperMessage;
View Full Code Here

            priorFailureException = null;
        }
       
        // Add all S3 objects as candiates for PUT signing.
        for (int i = 0; i < objects.length; i++) {
            SignatureRequest signatureRequest = new SignatureRequest(
                SignatureRequest.SIGNATURE_TYPE_PUT, objects[i].getKey());
            signatureRequest.setObjectMetadata(objects[i].getMetadataMap());
           
            gatekeeperMessage.addSignatureRequest(signatureRequest);
        }
       
       
View Full Code Here

    {
        List signedObjects = new ArrayList();
        String firstDeclineReason = null;
       
        for (int i = 0; i < signatureRequests.length; i++) {
            SignatureRequest request = signatureRequests[i];
            S3Object object = objects[i];
           
            // Store summary information in XML document generator.
            if (xmlGenerator != null) {
                Map clonedMetadata = new HashMap();
                clonedMetadata.putAll(object.getMetadataMap());
                xmlGenerator.addSignatureRequest(object.getKey(), object.getBucketName(),
                    clonedMetadata, request);
            }

            if (request.isSigned()) {
                // Update object with any changes dictated by Gatekeeper.
                if (request.getObjectKey() != null) {
                    object.setKey(request.getObjectKey());
                }
                if (request.getBucketName() != null) {
                    object.setBucketName(request.getBucketName());
                }
                if (request.getObjectMetadata() != null && request.getObjectMetadata().size() > 0) {
                    object.replaceAllMetadata(request.getObjectMetadata());
                }
               
                SignedUrlAndObject urlAndObject = new SignedUrlAndObject(request.getSignedUrl(), object);
                signedObjects.add(urlAndObject);
            } else {
                // If ANY requests are declined, we will fail with a fatal error message.
                String declineReason = (request.getDeclineReason() == null
                    ? "Unknown"
                    : request.getDeclineReason());
                log.warn("Upload of '" + objects[i].getKey() + "' was declined for reason: "
                    + declineReason);
                if (firstDeclineReason == null) {
                    firstDeclineReason = declineReason;
                }
View Full Code Here

TOP

Related Classes of org.jets3t.service.utils.gatekeeper.SignatureRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.