Browse Source

refactor: put the auth outside (#5313)

pull/5318/head
7y-9 10 months ago
committed by GitHub
parent
commit
41ec9d7759
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      weed/s3api/s3api_bucket_handlers.go
  2. 3
      weed/s3api/s3api_server.go

7
weed/s3api/s3api_bucket_handlers.go

@ -123,13 +123,6 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request)
return
}
if s3a.iam.isEnabled() {
if _, errCode = s3a.iam.authRequest(r, s3_constants.ACTION_ADMIN); errCode != s3err.ErrNone {
s3err.WriteErrorResponse(w, r, errCode)
return
}
}
fn := func(entry *filer_pb.Entry) {
if identityId := r.Header.Get(s3_constants.AmzIdentityId); identityId != "" {
if entry.Extended == nil {

3
weed/s3api/s3api_server.go

@ -276,7 +276,8 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
bucket.Methods("HEAD").HandlerFunc(track(s3a.iam.Auth(s3a.cb.Limit(s3a.HeadBucketHandler, ACTION_READ)), "GET"))
// PutBucket
bucket.Methods("PUT").HandlerFunc(track(s3a.PutBucketHandler, "PUT"))
bucket.Methods("PUT").HandlerFunc(track(s3a.iam.Auth(s3a.cb.Limit(s3a.PutBucketHandler, ACTION_ADMIN)), "PUT"))
// DeleteBucket
bucket.Methods("DELETE").HandlerFunc(track(s3a.iam.Auth(s3a.cb.Limit(s3a.DeleteBucketHandler, ACTION_ADMIN)), "DELETE"))

Loading…
Cancel
Save