hey! I'm using kotlin with coroutines with spring ...
# announcements
x
hey! I'm using kotlin with coroutines with spring webflux and I'm having some issues regarding KContinuation when trying to use PreAuthorize
I have a typical rest controller, with a preauthorization to verify the user is trying to access his own data
Copy code
@GetMapping(path = ["/test"])
@PreAuthorize("@authenticationService.authForGetOwnData(#userId)")
suspend fun getOwnData(
    @RequestParam(value = "user_id", required = true) userId: Long,
    @RequestParam(value = "from", required = true) from: Instant,
    @RequestParam(value = "to") to: Instant = Instant.now(),
): ownData =
    blabla
the issue im having is that i'm getting the following error:
Copy code
java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
	at org.springframework.security.access.expression.method.MethodSecurityEvaluationContext.addArgumentsAsVariables(MethodSecurityEvaluationContext.java:115)
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
for some reason its receiving an extra argument, with a KCallable
so its out of bounds
its related to this annotation:
Copy code
@EnableGlobalMethodSecurity(prePostEnabled = true)
this is solved, i had to use
Copy code
@EnableReactiveMethodSecurity
i blame staying up too late 🙂