Examples of GatekeeperMessage


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

       
        try {
            /*
             *  Build Gatekeeper request.
             */
            GatekeeperMessage gatekeeperMessage = new GatekeeperMessage();
            gatekeeperMessage.addApplicationProperties(userInputProperties); // Add User inputs as application properties.
            gatekeeperMessage.addApplicationProperties(parametersMap); // Add any Applet/Application parameters as application properties.

            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;
           
        } catch (Exception e) {
View Full Code Here

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

            "gatekeeperUrl", "Missing required property gatekeeperUrl");
       
        /*
         *  Build Gatekeeper request.
         */
        GatekeeperMessage gatekeeperMessage = new GatekeeperMessage();
        gatekeeperMessage.addApplicationProperties(userInputProperties); // Add User inputs as application properties.
        gatekeeperMessage.addApplicationProperties(parametersMap); // Add any Applet/Application parameters as application properties.

        // Make the Uploader's identifier available to Gatekeeper for version compatibility checking (if necessary)
        gatekeeperMessage.addApplicationProperty(
            GatekeeperMessage.PROPERTY_CLIENT_VERSION_ID, UPLOADER_VERSION_ID);       
       
        // If a prior failure has occurred, add information about this failure.
        if (priorFailureException != null) {
            gatekeeperMessage.addApplicationProperty(GatekeeperMessage.PROPERTY_PRIOR_FAILURE_MESSAGE,
                priorFailureException.getMessage());
            // Now reset the prior failure variable.
            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);
        }
       
       
        /*
         *  Build HttpClient POST message.
         */
       
        // Add all properties/parameters to credentials POST request.
        PostMethod postMethod = new PostMethod(gatekeeperUrl);
        Properties properties = gatekeeperMessage.encodeToProperties();
        Iterator propsIter = properties.entrySet().iterator();
        while (propsIter.hasNext()) {
            Map.Entry entry = (Map.Entry) propsIter.next();
            String fieldName = (String) entry.getKey();
            String fieldValue = (String) entry.getValue();
            postMethod.setParameter(fieldName, fieldValue);
        }

        // Create Http Client if necessary, and include User Agent information.
        if (httpClientGatekeeper == null) {
            httpClientGatekeeper = initHttpConnection();
        }
       
        // Try to detect any necessary proxy configurations.
        try {
            ProxyHost proxyHost = PluginProxyUtil.detectProxy(new URL(gatekeeperUrl));
            if (proxyHost != null) {
                HostConfiguration hostConfig = new HostConfiguration();
                hostConfig.setProxyHost(proxyHost);
                httpClientGatekeeper.setHostConfiguration(hostConfig);
               
                httpClientGatekeeper.getParams().setAuthenticationPreemptive(true);
                httpClientGatekeeper.getParams().setParameter(CredentialsProvider.PROVIDER, this);                    
            }
        } catch (Throwable t) {
            log.debug("No proxy detected");
        }           

        // Perform Gateway request.
        log.debug("Contacting Gatekeeper at: " + gatekeeperUrl);
        try {                       
            int responseCode = httpClientGatekeeper.executeMethod(postMethod);           
            String contentType = postMethod.getResponseHeader("Content-Type").getValue();
            if (responseCode == 200) {
                InputStream responseInputStream = null;

                Header encodingHeader = postMethod.getResponseHeader("Content-Encoding");
                if (encodingHeader != null && "gzip".equalsIgnoreCase(encodingHeader.getValue())) {
                    log.debug("Inflating gzip-encoded response");
                    responseInputStream = new GZIPInputStream(postMethod.getResponseBodyAsStream());
                } else {
                    responseInputStream = postMethod.getResponseBodyAsStream();
                }               
               
                if (responseInputStream == null) {
                    throw new IOException("No response input stream available from Gatekeeper");                   
                }        
               
                Properties responseProperties = new Properties();
                try {
                    responseProperties.load(responseInputStream);
                } finally {
                    responseInputStream.close();
                }

                GatekeeperMessage gatekeeperResponseMessage =
                    GatekeeperMessage.decodeFromProperties(responseProperties);
               
                // Check for Gatekeeper Error Code in response.
                String gatekeeperErrorCode = gatekeeperResponseMessage.getApplicationProperties()
                    .getProperty(GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE);
                if (gatekeeperErrorCode != null) {
                    log.warn("Received Gatekeeper error code: " + gatekeeperErrorCode);
                    failWithFatalError(gatekeeperErrorCode);
                    return null;
                }
               
                if (gatekeeperResponseMessage.getSignatureRequests().length != objects.length) {
                    throw new Exception("The Gatekeeper service did not provide the necessary "
                        + objects.length + " response items");
                }
               
                return gatekeeperResponseMessage;
View Full Code Here

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

        boolean s3CredentialsProvided =               
            userInputProperties.getProperty("AwsAccessKey") != null
            && userInputProperties.getProperty("AwsSecretKey") != null
            && userInputProperties.getProperty("S3BucketName") != null;

        GatekeeperMessage gatekeeperMessage = null;
        if (s3CredentialsProvided) {
            log.debug("S3 login credentials and bucket name are available, the Uploader "
                + "will generate its own Gatekeeper response");
            gatekeeperMessage = buildGatekeeperResponse(objects);
        } else {
View Full Code Here

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

                        "Missing property 'screen.4.connectingMessage'")));
                    progressBar.setValue(0);
                };
            });                
           
            GatekeeperMessage gatekeeperMessage = null;
           
            try {
                gatekeeperMessage = retrieveGatekeeperResponse(objectsForUpload);               
            } catch (Exception e) {
                log.info("Upload request was denied", e);               
                failWithFatalError(ERROR_CODE__UPLOAD_REQUEST_DECLINED);
                return;
            }
            // If we get a null response, presume the error has already been handled.
            if (gatekeeperMessage == null) {
                return;
            }
           
            log.debug("Gatekeeper response properties: " + gatekeeperMessage.encodeToProperties());
           
            XmlGenerator xmlGenerator = new XmlGenerator();
            xmlGenerator.addApplicationProperties(gatekeeperMessage.getApplicationProperties());
            xmlGenerator.addMessageProperties(gatekeeperMessage.getMessageProperties());
                                   
            SignedUrlAndObject[] uploadItems = prepareSignedObjects(
                objectsForUpload, gatekeeperMessage.getSignatureRequests(), xmlGenerator);
           
            if (s3ServiceMulti == null) {
                s3ServiceMulti = new S3ServiceMulti(
                    new RestS3Service(null, APPLICATION_DESCRIPTION, this), this);
            }
                     
            /*
             * Prepare XML Summary document for upload, if the summary option is set.
             */
            includeXmlSummaryDoc = uploaderProperties.getBoolProperty("xmlSummary", false);
            S3Object summaryXmlObject = null;
            if (includeXmlSummaryDoc) {
                String priorTransactionId = gatekeeperMessage.getMessageProperties().getProperty(
                    GatekeeperMessage.PROPERTY_TRANSACTION_ID);
                if (priorTransactionId == null) {
                    failWithFatalError(ERROR_CODE__TRANSACTION_ID_REQUIRED_TO_CREATE_XML_SUMMARY);
                    return;
                }
               
                summaryXmlObject = new S3Object(
                    null, priorTransactionId + ".xml", xmlGenerator.generateXml());
                summaryXmlObject.setContentType(Mimetypes.MIMETYPE_XML);
                summaryXmlObject.addMetadata(GatekeeperMessage.PROPERTY_TRANSACTION_ID, priorTransactionId);
                summaryXmlObject.addMetadata(GatekeeperMessage.SUMMARY_DOCUMENT_METADATA_FLAG, "true");                
            }
           
            // PUT the user's selected files in S3.
            uploadCancelled = false;
            uploadingFinalObject = (!includeXmlSummaryDoc);
            s3ServiceMulti.putObjects(uploadItems);
           
            // If an XML summary document is required, PUT this in S3 as well.
            if (includeXmlSummaryDoc && !uploadCancelled && !fatalErrorOccurred) {               
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        fileInformationLabel.setText(
                            replaceMessageVariables(uploaderProperties.getStringProperty("screen.4.summaryFileInformation",
                            "Missing property 'screen.4.summaryFileInformation'")));
                        progressStatusTextLabel.setText(
                            replaceMessageVariables(uploaderProperties.getStringProperty("screen.4.connectingMessage",
                            "Missing property 'screen.4.connectingMessage'")));
                    };
                });                                
               
                // Retrieve signed URL to PUT the XML summary document.
                gatekeeperMessage = retrieveGatekeeperResponse(new S3Object[] {summaryXmlObject});               
                SignedUrlAndObject[] xmlSummaryItem =
                    prepareSignedObjects(new S3Object[] {summaryXmlObject},
                        gatekeeperMessage.getSignatureRequests(), null);
               
                // PUT the XML summary document.
                uploadingFinalObject = true;
                s3ServiceMulti.putObjects(xmlSummaryItem);
            }
View Full Code Here

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

     */
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {     
        log.debug("Handling POST request");
        try {
            // Build Gatekeeper request from POST form parameters.
            GatekeeperMessage gatekeeperMessage =
                GatekeeperMessage.decodeFromProperties(request.getParameterMap());
                   
            // Obtain client information
            ClientInformation clientInformation = new ClientInformation(
                request.getRemoteAddr(), request.getRemoteHost(), request.getRemoteUser(),
                request.getRemotePort(), request.getSession(false), request.getUserPrincipal(),
                request.getHeader("User-Agent"), request);
                       
            // Generate Transaction ID, and store it in the message.
            String transactionId = transactionIdProvider.getTransactionId(gatekeeperMessage, clientInformation);
            if (transactionId != null) {
                gatekeeperMessage.addMessageProperty(GatekeeperMessage.PROPERTY_TRANSACTION_ID, transactionId);
            }
           
          if (!isInitCompleted)
          {
            log.warn("Cannot process POST request as Gatekeeper servlet did not initialize correctly");
            gatekeeperMessage.addApplicationProperty(
                        GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE, "GatekeeperInitializationError");           
          } else if (gatekeeperMessage.getApplicationProperties().containsKey(
                GatekeeperMessage.LIST_OBJECTS_IN_BUCKET_FLAG))
            {
                // Handle "limited listing" requests.
              log.debug("Listing objects");
              boolean allowed = authorizer.allowBucketListingRequest(gatekeeperMessage, clientInformation);
              if (allowed) {
                bucketLister.listObjects(gatekeeperMessage, clientInformation);
              }
            } 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.
            Properties responseProperties = gatekeeperMessage.encodeToProperties();
            log.debug("Sending response message as properties: " + responseProperties);           
           
            // Serialize properties to bytes.
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            responseProperties.store(baos, "");
View Full Code Here

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

        if (log.isDebugEnabled()) {
            log.debug("Handling POST request");
        }
        try {
            // Build Gatekeeper request from POST form parameters.
            GatekeeperMessage gatekeeperMessage =
                GatekeeperMessage.decodeFromProperties(request.getParameterMap());
                   
            // Obtain client information
            ClientInformation clientInformation = new ClientInformation(
                request.getRemoteAddr(), request.getRemoteHost(), request.getRemoteUser(),
                request.getRemotePort(), request.getSession(false), request.getUserPrincipal(),
                request.getHeader("User-Agent"), request);
                       
            // Generate Transaction ID, and store it in the message.
            String transactionId = transactionIdProvider.getTransactionId(gatekeeperMessage, clientInformation);
            if (transactionId != null) {
                gatekeeperMessage.addMessageProperty(GatekeeperMessage.PROPERTY_TRANSACTION_ID, transactionId);
            }
           
          if (!isInitCompleted)
          {
                if (log.isWarnEnabled()) {
                    log.warn("Cannot process POST request as Gatekeeper servlet did not initialize correctly");
                }
            gatekeeperMessage.addApplicationProperty(
                        GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE, "GatekeeperInitializationError");           
          } else if (gatekeeperMessage.getApplicationProperties().containsKey(
                GatekeeperMessage.LIST_OBJECTS_IN_BUCKET_FLAG))
            {
                // Handle "limited listing" requests.
                if (log.isDebugEnabled()) {
                    log.debug("Listing objects");
                }
              boolean allowed = authorizer.allowBucketListingRequest(gatekeeperMessage, clientInformation);
              if (allowed) {
                bucketLister.listObjects(gatekeeperMessage, clientInformation);
              }
            } else {
                if (log.isDebugEnabled()) {
                  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.
            Properties responseProperties = gatekeeperMessage.encodeToProperties();
            if (log.isDebugEnabled()) {
                log.debug("Sending response message as properties: " + responseProperties);
            }
           
            // Serialize properties to bytes.
View Full Code Here

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

        throws HttpException, Exception
    {
        /*
         *  Build Gatekeeper request.
         */
        GatekeeperMessage gatekeeperMessage = new GatekeeperMessage();
        gatekeeperMessage.addApplicationProperties(applicationPropertiesMap);       
        gatekeeperMessage.addApplicationProperty(
            GatekeeperMessage.PROPERTY_CLIENT_VERSION_ID, userAgentDescription);

        // If a prior failure has occurred, add information about this failure.
        if (priorFailureException != null) {
            gatekeeperMessage.addApplicationProperty(GatekeeperMessage.PROPERTY_PRIOR_FAILURE_MESSAGE,
                priorFailureException.getMessage());
            // Now reset the prior failure variable.
            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);
        }
               
        /*
         *  Build HttpClient POST message.
         */
       
        // Add all properties/parameters to credentials POST request.
        PostMethod postMethod = new PostMethod(gatekeeperUrl);
        Properties properties = gatekeeperMessage.encodeToProperties();
        Iterator propsIter = properties.entrySet().iterator();
        while (propsIter.hasNext()) {
            Map.Entry entry = (Map.Entry) propsIter.next();
            String fieldName = (String) entry.getKey();
            String fieldValue = (String) entry.getValue();
            postMethod.setParameter(fieldName, fieldValue);
        }

        // Create Http Client if necessary, and include User Agent information.
        if (httpClientGatekeeper == null) {
            httpClientGatekeeper = initHttpConnection();
        }
       
        // Try to detect any necessary proxy configurations.
        try {
            ProxyHost proxyHost = PluginProxyUtil.detectProxy(new URL(gatekeeperUrl));
            if (proxyHost != null) {
                HostConfiguration hostConfig = new HostConfiguration();
                hostConfig.setProxyHost(proxyHost);
                httpClientGatekeeper.setHostConfiguration(hostConfig);
            }
        } catch (Throwable t) {
            log.debug("No proxy detected");
        }           

        // Perform Gateway request.
        log.debug("Contacting Gatekeeper at: " + gatekeeperUrl);
        try {                       
            int responseCode = httpClientGatekeeper.executeMethod(postMethod);           
            String contentType = postMethod.getResponseHeader("Content-Type").getValue();
            if (responseCode == 200) {
                InputStream responseInputStream = null;

                Header encodingHeader = postMethod.getResponseHeader("Content-Encoding");
                if (encodingHeader != null && "gzip".equalsIgnoreCase(encodingHeader.getValue())) {
                    log.debug("Inflating gzip-encoded response");
                    responseInputStream = new GZIPInputStream(postMethod.getResponseBodyAsStream());
                } else {
                    responseInputStream = postMethod.getResponseBodyAsStream();
                }               
               
                if (responseInputStream == null) {
                    throw new IOException("No response input stream available from Gatekeeper");                   
                }        
               
                Properties responseProperties = new Properties();
                try {
                    responseProperties.load(responseInputStream);
                } finally {
                    responseInputStream.close();
                }

                GatekeeperMessage gatekeeperResponseMessage =
                    GatekeeperMessage.decodeFromProperties(responseProperties);
               
                // Check for Gatekeeper Error Code in response.
                String gatekeeperErrorCode = gatekeeperResponseMessage.getApplicationProperties()
                    .getProperty(GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE);
                if (gatekeeperErrorCode != null) {
                    log.warn("Received Gatekeeper error code: " + gatekeeperErrorCode);
                }
               
View Full Code Here

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

        requestProperties.putAll(cockpitLiteProperties.getProperties());
            if (filterObjectsCheckBox.isSelected() && filterObjectsPrefix.getText().length() > 0) {
                requestProperties.put("Prefix", filterObjectsPrefix.getText());               
            }
       
      GatekeeperMessage responseMessage =
        gkClient.requestActionThroughGatekeeper(
            null, null, new S3Object[] {}, requestProperties);   
     
      stopProgressPanel(this);
     
            String gatekeeperErrorCode = responseMessage.getApplicationProperties()
              .getProperty(GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE);
           
            if (gatekeeperErrorCode == null) {
              // Listing succeeded
          final S3Object[] objects = gkClient.buildS3ObjectsFromSignatureRequests(
          responseMessage.getSignatureRequests());
         
                // User account description provided by Gatekeeper
                final String accountDescription =
                    responseMessage.getApplicationProperties().getProperty("AccountDescription");
               
          // User's settings
                userCanUpload = "true".equalsIgnoreCase(
                    responseMessage.getApplicationProperties().getProperty("UserCanUpload"));
                userCanDownload = "true".equalsIgnoreCase(
                    responseMessage.getApplicationProperties().getProperty("UserCanDownload"));
                userCanDelete = "true".equalsIgnoreCase(
                    responseMessage.getApplicationProperties().getProperty("UserCanDelete"));
                userCanACL = "true".equalsIgnoreCase(
                    responseMessage.getApplicationProperties().getProperty("UserCanACL"));

                userBucketName = responseMessage.getApplicationProperties().getProperty("S3BucketName");
          userPath = responseMessage.getApplicationProperties().getProperty("UserPath", "");
          userVanityHost = responseMessage.getApplicationProperties().getProperty("UserVanityHost");
               
                objectTableModel.setUsersPath(userPath);
                uploadFilesMenuItem.setEnabled(userCanUpload);
         
                SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

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

   
    private SignatureRequest[] requestSignedRequests(String operationType, S3Object[] objects) {
      try {
            startProgressPanel(this, "Checking permissions", 0, null);
       
          GatekeeperMessage responseMessage = gkClient.requestActionThroughGatekeeper(
          operationType, userBucketName, objects, cockpitLiteProperties.getProperties());
         
      stopProgressPanel(this);
     
            String gatekeeperErrorCode = responseMessage.getApplicationProperties()
              .getProperty(GatekeeperMessage.APP_PROPERTY_GATEKEEPER_ERROR_CODE);
           
            if (gatekeeperErrorCode == null) {
              // Confirm that all the signatures requested were approved
              for (int i = 0; i < responseMessage.getSignatureRequests().length; i++) {
                if (responseMessage.getSignatureRequests()[i].getSignedUrl() == null) {
                      // Some permissions missing.
                      return null;
                }
              }
             
              return responseMessage.getSignatureRequests();
            } else {
              // No permissions
                return null;
//              ErrorDialog.showDialog(ownerFrame, null, appProperties.getProperties(),
//                "Sorry, you do not have the necessary permissions", null);                 
View Full Code Here

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

       
        try {
            /*
             *  Build Gatekeeper request.
             */
            GatekeeperMessage gatekeeperMessage = new GatekeeperMessage();
            gatekeeperMessage.addApplicationProperties(userInputProperties); // Add User inputs as application properties.
            gatekeeperMessage.addApplicationProperties(parametersMap); // Add any Applet/Application parameters as application properties.

            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;
           
        } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.