diff --git a/cmd/jwt/parser.go b/cmd/jwt/parser.go index adbf1a68c..72c97042c 100644 --- a/cmd/jwt/parser.go +++ b/cmd/jwt/parser.go @@ -81,6 +81,15 @@ type MapClaims struct { jwtgo.MapClaims } +// GetAccessKey will return the access key. +// If nil an empty string will be returned. +func (c *MapClaims) GetAccessKey() string { + if c == nil { + return "" + } + return c.AccessKey +} + // NewStandardClaims - initializes standard claims func NewStandardClaims() *StandardClaims { return &StandardClaims{} diff --git a/cmd/web-handlers.go b/cmd/web-handlers.go index 98c66456e..8a53b3dbf 100644 --- a/cmd/web-handlers.go +++ b/cmd/web-handlers.go @@ -226,7 +226,7 @@ func (web *webAPIHandlers) MakeBucket(r *http.Request, args *MakeBucketArgs, rep reply.UIVersion = Version reqParams := extractReqParams(r) - reqParams["accessKey"] = claims.AccessKey + reqParams["accessKey"] = claims.GetAccessKey() sendEvent(eventArgs{ EventName: event.BucketCreated, @@ -723,7 +723,7 @@ func (web *webAPIHandlers) RemoveObject(r *http.Request, args *RemoveObjectArgs, ) reqParams := extractReqParams(r) - reqParams["accessKey"] = claims.AccessKey + reqParams["accessKey"] = claims.GetAccessKey() sourceIP := handlers.GetSourceIP(r) next: @@ -1340,7 +1340,7 @@ func (web *webAPIHandlers) Upload(w http.ResponseWriter, r *http.Request) { } reqParams := extractReqParams(r) - reqParams["accessKey"] = claims.AccessKey + reqParams["accessKey"] = claims.GetAccessKey() // Notify object created event. sendEvent(eventArgs{ @@ -1529,7 +1529,7 @@ func (web *webAPIHandlers) Download(w http.ResponseWriter, r *http.Request) { } reqParams := extractReqParams(r) - reqParams["accessKey"] = claims.AccessKey + reqParams["accessKey"] = claims.GetAccessKey() // Notify object accessed via a GET request. sendEvent(eventArgs{ @@ -1684,7 +1684,7 @@ func (web *webAPIHandlers) DownloadZip(w http.ResponseWriter, r *http.Request) { defer archive.Close() reqParams := extractReqParams(r) - reqParams["accessKey"] = claims.AccessKey + reqParams["accessKey"] = claims.GetAccessKey() respElements := extractRespElements(w) for i, object := range args.Objects {