Remove GetClaimsFromContext backward compatibility helper #2443
+50
−227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Remove
GetClaimsFromContextfunction and migrate all usages toIdentityFromContextpattern following the authentication unification completed in #2437.Changes
GetClaimsFromContext()frompkg/auth/context.goIdentityFromContext()and accessidentity.Claimsdirectly when neededGetClaimsFromContexttest functionsRationale
GetClaimsFromContextwas added as a backward-compatibility helper during the Identity struct unification in #2437. All production code has migrated to usingIdentityFromContextdirectly, with zero production usages remaining. Tests should verify the actual production API contract.The function's comment even stated: "This is a helper function for backward compatibility with code that expects MapClaims. New code should use IdentityFromContext and access the Claims field directly."
Since all code is now "new code" using
IdentityFromContext, the backward compatibility layer is no longer needed.Impact
Production Usage Analysis
Verified that
GetClaimsFromContexthad zero production usages:pkg/audit/auditor.gousesIdentityFromContext()pkg/authz/cedar.gousesIdentityFromContext()pkg/auth/tokenexchange/middleware.gousesIdentityFromContext()The only usages were in test files, which have been updated to use the production pattern.
Testing
All tests pass:
Linting clean: