aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/auth_credentials.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-01-21 00:47:27 -0800
committerChris Lu <chris.lu@gmail.com>2021-01-21 00:47:27 -0800
commita9e6db1a8e964f10571a5e11c197fd2da141c6f7 (patch)
tree0a22db3d6c68178d8e913c1bffd550ae4127a7e1 /weed/s3api/auth_credentials.go
parentf0455dee683e831487c345a575b7894c0e2bf61a (diff)
parent84f05787f8eecfcb61e49882346ad5855b6bb784 (diff)
downloadseaweedfs-a9e6db1a8e964f10571a5e11c197fd2da141c6f7.tar.xz
seaweedfs-a9e6db1a8e964f10571a5e11c197fd2da141c6f7.zip
Merge branch 'master' into ftporigin/ftp
Diffstat (limited to 'weed/s3api/auth_credentials.go')
-rw-r--r--weed/s3api/auth_credentials.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go
index c305fee6f..b8af6381a 100644
--- a/weed/s3api/auth_credentials.go
+++ b/weed/s3api/auth_credentials.go
@@ -156,7 +156,36 @@ func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) htt
// check whether the request has valid access keys
func (iam *IdentityAccessManagement) authRequest(r *http.Request, action Action) (*Identity, s3err.ErrorCode) {
- identity, s3Err := iam.authUser(r)
+ var identity *Identity
+ var s3Err s3err.ErrorCode
+ var found bool
+ switch getRequestAuthType(r) {
+ case authTypeStreamingSigned:
+ return identity, s3err.ErrNone
+ case authTypeUnknown:
+ glog.V(3).Infof("unknown auth type")
+ return identity, s3err.ErrAccessDenied
+ case authTypePresignedV2, authTypeSignedV2:
+ glog.V(3).Infof("v2 auth type")
+ identity, s3Err = iam.isReqAuthenticatedV2(r)
+ case authTypeSigned, authTypePresigned:
+ glog.V(3).Infof("v4 auth type")
+ identity, s3Err = iam.reqSignatureV4Verify(r)
+ case authTypePostPolicy:
+ glog.V(3).Infof("post policy auth type")
+ return identity, s3err.ErrNone
+ case authTypeJWT:
+ glog.V(3).Infof("jwt auth type")
+ return identity, s3err.ErrNotImplemented
+ case authTypeAnonymous:
+ identity, found = iam.lookupAnonymous()
+ if !found {
+ return identity, s3err.ErrAccessDenied
+ }
+ default:
+ return identity, s3err.ErrNotImplemented
+ }
+
if s3Err != s3err.ErrNone {
return identity, s3Err
}