Skip to content

AuthorizationManager[Before/After]ReactiveMethodInterceptor doesn't support Kotlin coroutines #12080

Closed
@jarias

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

Labels

in: webAn issue in web modules (web, webmvc)type: enhancementA general enhancement

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions