aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/s3api/s3api_auth.go')
-rw-r--r--weed/s3api/s3api_auth.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/weed/s3api/s3api_auth.go b/weed/s3api/s3api_auth.go
index 8424e7d2c..e946b1284 100644
--- a/weed/s3api/s3api_auth.go
+++ b/weed/s3api/s3api_auth.go
@@ -77,24 +77,29 @@ const (
// Get request authentication type.
func getRequestAuthType(r *http.Request) authType {
+ var authType authType
+
if isRequestSignatureV2(r) {
- return authTypeSignedV2
+ authType = authTypeSignedV2
} else if isRequestPresignedSignatureV2(r) {
- return authTypePresignedV2
+ authType = authTypePresignedV2
} else if isRequestSignStreamingV4(r) {
- return authTypeStreamingSigned
+ authType = authTypeStreamingSigned
} else if isRequestUnsignedStreaming(r) {
- return authTypeStreamingUnsigned
+ authType = authTypeStreamingUnsigned
} else if isRequestSignatureV4(r) {
- return authTypeSigned
+ authType = authTypeSigned
} else if isRequestPresignedSignatureV4(r) {
- return authTypePresigned
+ authType = authTypePresigned
} else if isRequestJWT(r) {
- return authTypeJWT
+ authType = authTypeJWT
} else if isRequestPostPolicySignatureV4(r) {
- return authTypePostPolicy
+ authType = authTypePostPolicy
} else if _, ok := r.Header["Authorization"]; !ok {
- return authTypeAnonymous
+ authType = authTypeAnonymous
+ } else {
+ authType = authTypeUnknown
}
- return authTypeUnknown
+
+ return authType
}