diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-11-21 14:46:32 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 14:46:32 -0800 |
| commit | f125a013a8eefd15cc26b01a1a88a45381a772f9 (patch) | |
| tree | 4102feba79ebbdf5b52f66d1005c1f65c9497492 /weed/s3api/auth_credentials.go | |
| parent | a9fefcd22cc7e35afa6c632ea307d1ae28eb7f03 (diff) | |
| download | seaweedfs-f125a013a8eefd15cc26b01a1a88a45381a772f9.tar.xz seaweedfs-f125a013a8eefd15cc26b01a1a88a45381a772f9.zip | |
S3: set identity to request context, and remove obsolete code (#7523)
* list owned buckets
* simplify
* add unit tests
* no-owner buckets
* set identity id
* fallback to request header if iam is not enabled
* refactor to test
* fix comparing
* fix security vulnerability
* Update s3api_bucket_handlers.go
* Update s3api_bucket_handlers.go
* Update s3api_bucket_handlers.go
* set identity to request context
* remove SeaweedFSIsDirectoryKey
* remove obsolete
* simplify
* reuse
* refactor or remove obsolete logic on filer
* Removed the redundant check in GetOrHeadHandler
* surfacing invalid X-Amz-Tagging as a client error
* clean up
* constant
* reuse
* multiple header values
* code reuse
* err on duplicated tag key
Diffstat (limited to 'weed/s3api/auth_credentials.go')
| -rw-r--r-- | weed/s3api/auth_credentials.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index 289fbd556..0d99e43eb 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -421,8 +421,10 @@ func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) htt glog.V(3).Infof("auth error: %v", errCode) if errCode == s3err.ErrNone { + // Store the authenticated identity in request context (secure, cannot be spoofed) if identity != nil && identity.Name != "" { - r.Header.Set(s3_constants.AmzIdentityId, identity.Name) + ctx := s3_constants.SetIdentityNameInContext(r.Context(), identity.Name) + r = r.WithContext(ctx) } f(w, r) return |
