@Bean public PrePostAdviceReactiveMethodInterceptor securityMethodInterceptor(AbstractMethodSecurityMetadataSource source, MethodSecurityExpressionHandler handler) { ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice( handler); ExpressionBasedPreInvocationAdvice preAdvice = new ExpressionBasedPreInvocationAdvice(); preAdvice.setExpressionHandler(handler); return new PrePostAdviceReactiveMethodInterceptor(source, preAdvice, postAdvice); }
.getAttributes(method, targetClass); PreInvocationAttribute preAttr = findPreInvocationAttribute(attributes); Mono<Authentication> toInvoke = ReactiveSecurityContextHolder.getContext() .map(SecurityContext::getAuthentication) PostInvocationAttribute attr = findPostInvocationAttribute(attributes); .flatMap( auth -> this.<Mono<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> this.<Flux<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> Flux.from(this.<Publisher<?>>proceed(invocation)) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) );
.getAttributes(method, targetClass); PreInvocationAttribute preAttr = findPreInvocationAttribute(attributes); Mono<Authentication> toInvoke = ReactiveSecurityContextHolder.getContext() .map(SecurityContext::getAuthentication) PostInvocationAttribute attr = findPostInvocationAttribute(attributes); .flatMap( auth -> this.<Mono<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> this.<Flux<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> Flux.from(this.<Publisher<?>>proceed(invocation)) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) );
@Bean public PrePostAdviceReactiveMethodInterceptor securityMethodInterceptor(AbstractMethodSecurityMetadataSource source, MethodSecurityExpressionHandler handler) { ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice( handler); ExpressionBasedPreInvocationAdvice preAdvice = new ExpressionBasedPreInvocationAdvice(); preAdvice.setExpressionHandler(handler); return new PrePostAdviceReactiveMethodInterceptor(source, preAdvice, postAdvice); }
.getAttributes(method, targetClass); PreInvocationAttribute preAttr = findPreInvocationAttribute(attributes); Mono<Authentication> toInvoke = ReactiveSecurityContextHolder.getContext() .map(SecurityContext::getAuthentication) PostInvocationAttribute attr = findPostInvocationAttribute(attributes); .flatMap( auth -> this.<Mono<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> this.<Flux<?>>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); .flatMapMany( auth -> Flux.from(this.<Publisher<?>>proceed(invocation)) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) );
@Bean public PrePostAdviceReactiveMethodInterceptor securityMethodInterceptor(AbstractMethodSecurityMetadataSource source, MethodSecurityExpressionHandler handler) { ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice( handler); ExpressionBasedPreInvocationAdvice preAdvice = new ExpressionBasedPreInvocationAdvice(); preAdvice.setExpressionHandler(handler); return new PrePostAdviceReactiveMethodInterceptor(source, preAdvice, postAdvice); }