accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
/*
|
2018-03-15 16:03:41 -04:00
|
|
|
* Minio Cloud Storage, (C) 2015, 2016, 2017, 2018 Minio, Inc.
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2016-08-18 19:23:42 -04:00
|
|
|
package cmd
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
|
|
|
|
import (
|
2017-10-27 19:14:06 -04:00
|
|
|
"encoding/json"
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
|
2016-11-22 21:18:22 -05:00
|
|
|
humanize "github.com/dustin/go-humanize"
|
2018-04-21 22:23:54 -04:00
|
|
|
"github.com/gorilla/mux"
|
2018-04-05 18:04:40 -04:00
|
|
|
"github.com/minio/minio/cmd/logger"
|
2018-04-24 18:53:30 -04:00
|
|
|
"github.com/minio/minio/pkg/policy"
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
)
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
const (
|
|
|
|
// As per AWS S3 specification, 20KiB policy JSON data is allowed.
|
|
|
|
maxBucketPolicySize = 20 * humanize.KiByte
|
2016-05-04 19:56:57 -04:00
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// Policy configuration file.
|
|
|
|
bucketPolicyConfig = "policy.json"
|
|
|
|
)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// PutBucketPolicyHandler - This HTTP handler stores given bucket policy configuration as per
|
|
|
|
// https://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
|
2016-04-12 15:45:15 -04:00
|
|
|
func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
2018-03-14 15:01:47 -04:00
|
|
|
ctx := newContext(r, "PutBucketPolicy")
|
|
|
|
|
2016-08-10 21:47:49 -04:00
|
|
|
objAPI := api.ObjectAPI()
|
|
|
|
if objAPI == nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, ErrServerNotInitialized, r.URL)
|
2016-08-10 21:47:49 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.PutBucketPolicyAction, bucket, ""); s3Error != ErrNone {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, s3Error, r.URL)
|
2016-03-12 19:08:15 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// Check if bucket exists.
|
|
|
|
if _, err := objAPI.GetBucketInfo(ctx, bucket); err != nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
2016-11-14 18:45:00 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// Error out if Content-Length is missing.
|
|
|
|
// PutBucketPolicy always needs Content-Length.
|
|
|
|
if r.ContentLength <= 0 {
|
2017-01-20 19:33:01 -05:00
|
|
|
writeErrorResponse(w, ErrMissingContentLength, r.URL)
|
|
|
|
return
|
|
|
|
}
|
2018-04-24 18:53:30 -04:00
|
|
|
|
|
|
|
// Error out if Content-Length is beyond allowed size.
|
|
|
|
if r.ContentLength > maxBucketPolicySize {
|
2017-01-20 19:33:01 -05:00
|
|
|
writeErrorResponse(w, ErrEntityTooLarge, r.URL)
|
|
|
|
return
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
bucketPolicy, err := policy.ParseConfig(io.LimitReader(r.Body, r.ContentLength), bucket)
|
2016-04-29 17:24:10 -04:00
|
|
|
if err != nil {
|
2018-04-24 18:53:30 -04:00
|
|
|
writeErrorResponse(w, ErrMalformedPolicy, r.URL)
|
bucketpolicy: Improve bucket policy validation, avoid nested rules.
Bucket policy validation is more stricter now, to avoid nested
rules. The reason to do this is keep the rules simpler and more
meaningful avoiding conflicts.
This patch implements stricter checks.
Example policy to be generally avoided.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:DeleteObject"
],
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Resource": [
"arn:aws:s3:::jarjarbing/*"
]
},
{
"Action": [
"s3:GetObject",
"s3:DeleteObject"
],
"Effect": "Deny",
"Principal": {
"AWS": [
"*"
]
},
"Resource": [
"arn:aws:s3:::jarjarbing/restic/key/*"
]
}
]
}
```
2016-03-15 13:38:04 -04:00
|
|
|
return
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
}
|
|
|
|
|
2018-04-27 18:02:54 -04:00
|
|
|
// Version in policy must not be empty
|
|
|
|
if bucketPolicy.Version == "" {
|
|
|
|
writeErrorResponse(w, ErrMalformedPolicy, r.URL)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
if err = objAPI.SetBucketPolicy(ctx, bucket, bucketPolicy); err != nil {
|
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
2018-02-09 18:19:30 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
globalPolicySys.Set(bucket, *bucketPolicy)
|
2018-05-09 18:11:51 -04:00
|
|
|
for nerr := range globalNotificationSys.SetBucketPolicy(bucket, bucketPolicy) {
|
2018-05-09 14:25:38 -04:00
|
|
|
logger.GetReqInfo(ctx).AppendTags("remotePeer", nerr.Host.Name)
|
|
|
|
logger.LogIf(ctx, nerr.Err)
|
2018-03-15 16:03:41 -04:00
|
|
|
}
|
|
|
|
|
2016-08-10 23:10:48 -04:00
|
|
|
// Success.
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
writeSuccessNoContent(w)
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// DeleteBucketPolicyHandler - This HTTP handler removes bucket policy configuration.
|
2016-04-12 15:45:15 -04:00
|
|
|
func (api objectAPIHandlers) DeleteBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
2018-03-14 15:01:47 -04:00
|
|
|
ctx := newContext(r, "DeleteBucketPolicy")
|
|
|
|
|
2016-08-10 21:47:49 -04:00
|
|
|
objAPI := api.ObjectAPI()
|
|
|
|
if objAPI == nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, ErrServerNotInitialized, r.URL)
|
2016-08-10 21:47:49 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.DeleteBucketPolicyAction, bucket, ""); s3Error != ErrNone {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, s3Error, r.URL)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// Check if bucket exists.
|
|
|
|
if _, err := objAPI.GetBucketInfo(ctx, bucket); err != nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
2016-11-14 18:45:00 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-03-14 15:01:47 -04:00
|
|
|
if err := objAPI.DeleteBucketPolicy(ctx, bucket); err != nil {
|
2017-10-27 19:14:06 -04:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
return
|
|
|
|
}
|
2016-08-10 23:10:48 -04:00
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
globalPolicySys.Remove(bucket)
|
2018-05-09 18:11:51 -04:00
|
|
|
for nerr := range globalNotificationSys.RemoveBucketPolicy(bucket) {
|
2018-05-09 14:25:38 -04:00
|
|
|
logger.GetReqInfo(ctx).AppendTags("remotePeer", nerr.Host.Name)
|
|
|
|
logger.LogIf(ctx, nerr.Err)
|
2018-03-15 16:03:41 -04:00
|
|
|
}
|
|
|
|
|
2016-08-10 23:10:48 -04:00
|
|
|
// Success.
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
writeSuccessNoContent(w)
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// GetBucketPolicyHandler - This HTTP handler returns bucket policy configuration.
|
2016-04-12 15:45:15 -04:00
|
|
|
func (api objectAPIHandlers) GetBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
2018-03-14 15:01:47 -04:00
|
|
|
ctx := newContext(r, "GetBucketPolicy")
|
|
|
|
|
2016-08-10 21:47:49 -04:00
|
|
|
objAPI := api.ObjectAPI()
|
|
|
|
if objAPI == nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, ErrServerNotInitialized, r.URL)
|
2016-08-10 21:47:49 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucket := vars["bucket"]
|
|
|
|
|
|
|
|
if s3Error := checkRequestAuthType(ctx, r, policy.GetBucketPolicyAction, bucket, ""); s3Error != ErrNone {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, s3Error, r.URL)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
// Check if bucket exists.
|
|
|
|
if _, err := objAPI.GetBucketInfo(ctx, bucket); err != nil {
|
2017-01-06 03:37:00 -05:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
2016-11-14 18:45:00 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
// Read bucket access policy.
|
2018-04-24 18:53:30 -04:00
|
|
|
bucketPolicy, err := objAPI.GetBucketPolicy(ctx, bucket)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
if err != nil {
|
2017-10-27 19:14:06 -04:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-04-24 18:53:30 -04:00
|
|
|
policyData, err := json.Marshal(bucketPolicy)
|
2017-10-27 19:14:06 -04:00
|
|
|
if err != nil {
|
2018-04-05 18:04:40 -04:00
|
|
|
logger.LogIf(ctx, err)
|
2017-10-27 19:14:06 -04:00
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
return
|
|
|
|
}
|
2016-08-10 23:10:48 -04:00
|
|
|
|
|
|
|
// Write to client.
|
2018-04-24 18:53:30 -04:00
|
|
|
w.Write(policyData)
|
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
|
|
|
}
|