Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Trace Skipped and Deciding Authorization Rules - #20195

Draft
fhrmrk wants to merge 1 commit into
spring-projects:mainfrom
fhrmrk:gh-20174-trace
Draft

fhrmrk wants to merge 1 commit into
spring-projects:mainfrom
fhrmrk:gh-20174-trace

Conversation

@fhrmrk

@fhrmrk fhrmrk commented Dec 1, 2026

Copy link
Copy Markdown

This addresses the second item of gh-20174, "Emit an authorization trace for each decision".

RequestMatcherDelegatingAuthorizationManager already traces the request and the manager it delegates to. With this change it also traces:

  • each rule that was skipped because its request matcher did not match
  • which request matcher caused the deciding rule to be selected
  • the result that rule produced

For a request to GET /admin/users against three rules, the trace looks like this:

Authorizing GET /admin/users
Skipping [PathPattern [/public/**] -> SingleResultAuthorizationManager@7bb996e0] since it did not match GET /admin/users
Checking authorization on GET /admin/users using SingleResultAuthorizationManager@da2303c since it matched PathPattern [/admin/**]
Authorization on GET /admin/users decided by [PathPattern [/admin/**] -> SingleResultAuthorizationManager@da2303c] with result AuthorizationDecision [granted=false]

Notes for review

  • Everything is guarded by isTraceEnabled(), so there is no added cost on the hot path when trace logging is off.
  • The managers print as Class@hash here because most of them have no toString() yet. Log Effective Authorization Rules #20194 adds those, so the two PRs read best together, but this one does not depend on it.
  • I kept one trace event per rule to stay consistent with the existing trace messages in this class. I'm happy to collapse them into a single event per request if you prefer.

Issue gh-20174

RequestMatcherDelegatingAuthorizationManager now traces each rule
that did not match the request, the rule that matched, and the
result that rule produced, so that it is clear which rules were
tried and which one made the decision.

Issue spring-projectsgh-20174

Signed-off-by: 박종현 <fhrmrk@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants