mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
check signature only when auth is enabled
This commit is contained in:
parent
fcb0ff9890
commit
828a5ae429
|
@ -40,20 +40,22 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
rAuthType := getRequestAuthType(r)
|
||||
dataReader := r.Body
|
||||
var s3ErrCode ErrorCode
|
||||
switch rAuthType {
|
||||
case authTypeStreamingSigned:
|
||||
dataReader, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r)
|
||||
case authTypeSignedV2, authTypePresignedV2:
|
||||
_, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r)
|
||||
case authTypePresigned, authTypeSigned:
|
||||
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r)
|
||||
}
|
||||
if s3ErrCode != ErrNone {
|
||||
writeErrorResponse(w, s3ErrCode, r.URL)
|
||||
return
|
||||
if s3a.iam.isEnabled() {
|
||||
rAuthType := getRequestAuthType(r)
|
||||
var s3ErrCode ErrorCode
|
||||
switch rAuthType {
|
||||
case authTypeStreamingSigned:
|
||||
dataReader, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r)
|
||||
case authTypeSignedV2, authTypePresignedV2:
|
||||
_, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r)
|
||||
case authTypePresigned, authTypeSigned:
|
||||
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r)
|
||||
}
|
||||
if s3ErrCode != ErrNone {
|
||||
writeErrorResponse(w, s3ErrCode, r.URL)
|
||||
return
|
||||
}
|
||||
}
|
||||
defer dataReader.Close()
|
||||
|
||||
|
|
|
@ -179,20 +179,22 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ
|
|||
return
|
||||
}
|
||||
|
||||
rAuthType := getRequestAuthType(r)
|
||||
dataReader := r.Body
|
||||
var s3ErrCode ErrorCode
|
||||
switch rAuthType {
|
||||
case authTypeStreamingSigned:
|
||||
dataReader, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r)
|
||||
case authTypeSignedV2, authTypePresignedV2:
|
||||
_, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r)
|
||||
case authTypePresigned, authTypeSigned:
|
||||
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r)
|
||||
}
|
||||
if s3ErrCode != ErrNone {
|
||||
writeErrorResponse(w, s3ErrCode, r.URL)
|
||||
return
|
||||
if s3a.iam.isEnabled() {
|
||||
rAuthType := getRequestAuthType(r)
|
||||
var s3ErrCode ErrorCode
|
||||
switch rAuthType {
|
||||
case authTypeStreamingSigned:
|
||||
dataReader, s3ErrCode = s3a.iam.newSignV4ChunkedReader(r)
|
||||
case authTypeSignedV2, authTypePresignedV2:
|
||||
_, s3ErrCode = s3a.iam.isReqAuthenticatedV2(r)
|
||||
case authTypePresigned, authTypeSigned:
|
||||
_, s3ErrCode = s3a.iam.reqSignatureV4Verify(r)
|
||||
}
|
||||
if s3ErrCode != ErrNone {
|
||||
writeErrorResponse(w, s3ErrCode, r.URL)
|
||||
return
|
||||
}
|
||||
}
|
||||
defer dataReader.Close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue