This commit is contained in:
Chris Lu
2026-02-19 17:28:58 -08:00
parent c4e4552e73
commit 96b59b4c1f
+6 -5
View File
@@ -213,6 +213,12 @@ func buildIAMRequestContext(r *http.Request, claims map[string]interface{}) map[
return ctx
}
// getIdentityStructValue fetches the identity struct held in the request context.
// The identity is expected to be a pointer to a struct with the fields used by
// the reflection helpers (PrincipalArn string, PolicyNames []string,
// Claims map[string]interface{}).
// This helper centralizes the nil-check and ptr-deref logic so callers focus on
// reading the specific fields they need.
func getIdentityStructValue(r *http.Request) (reflect.Value, bool) {
identityRaw := s3_constants.GetIdentityFromContext(r)
if identityRaw == nil {
@@ -227,8 +233,3 @@ func getIdentityStructValue(r *http.Request) (reflect.Value, bool) {
}
return val, true
}
// The identity structure is expected to be a pointer to a struct with the
// reflection fields used below (PrincipalArn string, PolicyNames []string,
// Claims map[string]interface{}). This helper centralizes the nil-check / ptr-deref
// logic so the callers can focus on reading the proper field.