Package com.cloud.bridge.service.core.s3

Examples of com.cloud.bridge.service.core.s3.S3PolicyContext


  // [B]
  // "The bucket owner by default has permissions to retrieve bucket policies using GET Bucket policy."
  // -> the bucket owner may want to restrict the IP address from where
  // this can be executed
  String client = UserContext.current().getCanonicalUserId();
  S3PolicyContext context = new S3PolicyContext(
    PolicyActions.GetBucketPolicy, bucketName);
  switch (S3Engine.verifyPolicy(context)) {
  case ALLOW:
      break;
View Full Code Here


    // [B] The owner may want to restrict the IP address at which this can be performed
    String client = UserContext.current().getCanonicalUserId();
    if (!client.equals( sbucket.getOwnerCanonicalId()))
        throw new PermissionDeniedException( "Access Denied - only the owner can read bucket versioning" );

    S3PolicyContext context = new S3PolicyContext( PolicyActions.GetBucketVersioning, bucketName );
      if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
             response.setStatus(403);
             return;
      }
View Full Code Here

      String client = UserContext.current().getCanonicalUserId();
      if (!client.equals(sbucket.getOwnerCanonicalId()))
    throw new PermissionDeniedException(
      "Access Denied - only the owner can turn on versioing on a bucket");

      S3PolicyContext context = new S3PolicyContext(
        PolicyActions.PutBucketVersioning, bucketName);
      if (PolicyAccess.DENY == S3Engine.verifyPolicy(context)) {
    response.setStatus(403);
    return;
      }
View Full Code Here

        + " does not exist");
      response.setStatus(404);
      return;
  }

  S3PolicyContext context = new S3PolicyContext(
    PolicyActions.ListBucketMultipartUploads, bucketName);
  context.setEvalParam(ConditionKeys.Prefix, prefix);
  context.setEvalParam(ConditionKeys.Delimiter, delimiter);
  S3Engine.verifyAccess(context, "SBucket", bucket.getId(),
    SAcl.PERMISSION_READ);

  // [B] Query the multipart table to get the list of current uploads
  try {
View Full Code Here

          initiator = uploadDao.getInitiator( uploadId );
          if (null == initiator || !initiator.equals( UserContext.current().getAccessKey()))
          {
            try {
                // -> write permission on a bucket allows a PutObject / DeleteObject action on any object in the bucket
              S3PolicyContext context = new S3PolicyContext( PolicyActions.ListMultipartUploadParts, bucketName );
              context.setKeyName( exists.getSecond());
              S3Engine.verifyAccess( context, "SBucket", bucket.getId(), SAcl.PERMISSION_WRITE );
            }
            catch (PermissionDeniedException e) {
              response.setStatus(403);
              return;
View Full Code Here


        // [B] "The bucket owner by default has permissions to attach bucket policies to their buckets using PUT Bucket policy."
        //  -> the bucket owner may want to restrict the IP address from where this can be executed
        String client = UserContext.current().getCanonicalUserId();
        S3PolicyContext context = new S3PolicyContext(
                PolicyActions.PutBucketPolicy, bucketName);

        switch (S3Engine.verifyPolicy(context)) {
        case ALLOW:
            break;
View Full Code Here

        // [B]
        // "The bucket owner by default has permissions to retrieve bucket policies using GET Bucket policy."
        // -> the bucket owner may want to restrict the IP address from where
        // this can be executed
        String client = UserContext.current().getCanonicalUserId();
        S3PolicyContext context = new S3PolicyContext(
                PolicyActions.GetBucketPolicy, bucketName);
        switch (S3Engine.verifyPolicy(context)) {
        case ALLOW:
            break;
View Full Code Here

        // [B] The owner may want to restrict the IP address at which this can be performed
        String client = UserContext.current().getCanonicalUserId();
        if (!client.equals( sbucket.getOwnerCanonicalId()))
            throw new PermissionDeniedException( "Access Denied - only the owner can read bucket versioning" );

        S3PolicyContext context = new S3PolicyContext( PolicyActions.GetBucketVersioning, bucketName );
        if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
            response.setStatus(403);
            return;
        }
View Full Code Here

            String client = UserContext.current().getCanonicalUserId();
            if (!client.equals(sbucket.getOwnerCanonicalId()))
                throw new PermissionDeniedException(
                        "Access Denied - only the owner can turn on versioing on a bucket");

            S3PolicyContext context = new S3PolicyContext(
                    PolicyActions.PutBucketVersioning, bucketName);
            if (PolicyAccess.DENY == S3Engine.verifyPolicy(context)) {
                response.setStatus(403);
                return;
            }
View Full Code Here

                    + " does not exist");
            response.setStatus(404);
            return;
        }

        S3PolicyContext context = new S3PolicyContext(
                PolicyActions.ListBucketMultipartUploads, bucketName);
        context.setEvalParam(ConditionKeys.Prefix, prefix);
        context.setEvalParam(ConditionKeys.Delimiter, delimiter);
        S3Engine.verifyAccess(context, "SBucket", bucket.getId(),
                SAcl.PERMISSION_READ);

        // [B] Query the multipart table to get the list of current uploads
        try {
View Full Code Here

TOP

Related Classes of com.cloud.bridge.service.core.s3.S3PolicyContext

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.