AuthorizationManager[Before/After]ReactiveMethodInterceptor doesn't support Kotlin coroutines #12080
Closed
Description
Expected Behavior
AuthorizationManager[Before/After]ReactiveMethodInterceptor
should suport Kotlin coroutines
Current Behavior
The now deprecated PrePostAdviceReactiveMethodInterceptor
did support Kotlin coroutines but the newer counterparts don't
Context
At least when using a custom annotation with the new AuthorizationManager[Before/After]ReactiveMethodInterceptor
like:
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
fun customAuthorize(): Advisor {
val pointcut = Pointcuts.union(
AnnotationMatchingPointcut(null, Can::class.java, true),
AnnotationMatchingPointcut(Can::class.java, true)
)
val interceptor = AuthorizationManagerBeforeReactiveMethodInterceptor(
pointcut,
CanDoAuthorizationManager()
)
interceptor.order = AuthorizationInterceptorsOrder.PRE_AUTHORIZE.order + 1
return interceptor
}
I can't annotated suspended functions in Kotlin, looking at the deprecated PrePostAdviceReactiveMethodInterceptor
coroutines functionality was added a while back, but looks like the same functionality wasn't ported to the new classes.
Workaround is to use mono {}
to wrap the suspended functions and return Mono instead to satisfy
Metadata
Assignees
Type
Projects
Status
Done