Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CountedAspect causes IllegalStateException if used together with AuthorizationManagerBeforeReactiveMethodInterceptor #4986

Open
ghenadiibatalski opened this issue Apr 24, 2024 · 0 comments

Comments

@ghenadiibatalski
Copy link

ghenadiibatalski commented Apr 24, 2024

Describe the bug
Using @Counted with the @PreAuthorize annotated class causes an exception in reactive spring context

Required to bind 2 arguments, but only bound 1 (JoinPointMatch was NOT bound in invocation)
java.lang.IllegalStateException: Required to bind 2 arguments, but only bound 1 (JoinPointMatch was NOT bound in invocation)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.argBinding(AbstractAspectJAdvice.java:601)
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoDefer] :
	reactor.core.publisher.Mono.defer
	org.springframework.security.authorization.method.AuthorizationManagerBeforeReactiveMethodInterceptor.invoke(AuthorizationManagerBeforeReactiveMethodInterceptor.java:139)
Error has been observed at the following site(s):
	*__Mono.defer ? at org.springframework.security.authorization.method.AuthorizationManagerBeforeReactiveMethodInterceptor.invoke(AuthorizationManagerBeforeReactiveMethodInterceptor.java:139)
	*___Mono.then ? at org.springframework.security.authorization.method.AuthorizationManagerBeforeReactiveMethodInterceptor.invoke(AuthorizationManagerBeforeReactiveMethodInterceptor.java:140)
	|_  Mono.from ? at org.springframework.core.ReactiveAdapterRegistry$ReactorAdapter.toPublisher(ReactiveAdapterRegistry.java:260)
	|_  Mono.from ? at org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler.writeBody(AbstractMessageWriterResultHandler.java:160)
	|_            ? at org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler.writeBody(AbstractMessageWriterResultHandler.java:112)
	|_            ? at org.springframework.web.reactive.result.method.annotation.ResponseBodyResultHandler.handleResult(ResponseBodyResultHandler.java:96)

Environment
spring boot 3.2.5

  • Micrometer version 1.12.5
  • Micrometer registry: simple
  • OS: windows/linux
  • Java version: 21

To Reproduce
How to reproduce the bug:
Simple restcontroller with @EnableReactiveMethodSecurity annotated with @PreAuthorize and a controller method annotated with @Counted

Expected behavior
it just works without problems, authorizes and counts calls correctly

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant