From 166ef09c3dd27bbe9de343e2a34fbf69a1be7485 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 10 Mar 2016 17:36:48 -0800 Subject: [PATCH] auth: Detect anonymous as the last resort. --- auth-handler.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/auth-handler.go b/auth-handler.go index df740654e..718abc201 100644 --- a/auth-handler.go +++ b/auth-handler.go @@ -91,9 +91,6 @@ const ( // Get request authentication type. func getRequestAuthType(r *http.Request) authType { - if _, ok := r.Header["Authorization"]; !ok { - return authTypeAnonymous - } if isRequestSignatureV4(r) { return authTypeSigned } else if isRequestPresignedSignatureV4(r) { @@ -102,6 +99,8 @@ func getRequestAuthType(r *http.Request) authType { return authTypeJWT } else if isRequestPostPolicySignatureV4(r) { return authTypePostPolicy + } else if _, ok := r.Header["Authorization"]; !ok { + return authTypeAnonymous } return authTypeUnknown }