Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-v committed Mar 24, 2021
1 parent 58d61f3 commit 37a5c17
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.util.context.Context;
import reactor.util.context.ContextView;

public final class ServiceMethodInvoker {

Expand Down Expand Up @@ -71,7 +70,7 @@ public ServiceMethodInvoker(
* @return mono of service message
*/
public Mono<ServiceMessage> invokeOne(ServiceMessage message) {
return Mono.deferContextual(context -> authenticate(message, context))
return Mono.deferContextual(context -> authenticate(message, (Context) context))
.flatMap(authData -> deferWithContextOne(message, authData))
.map(response -> toResponse(response, message.qualifier(), message.dataFormat()))
.onErrorResume(
Expand All @@ -85,7 +84,7 @@ public Mono<ServiceMessage> invokeOne(ServiceMessage message) {
* @return flux of service messages
*/
public Flux<ServiceMessage> invokeMany(ServiceMessage message) {
return Mono.deferContextual(context -> authenticate(message, context))
return Mono.deferContextual(context -> authenticate(message, (Context) context))
.flatMapMany(authData -> deferWithContextMany(message, authData))
.map(response -> toResponse(response, message.qualifier(), message.dataFormat()))
.onErrorResume(
Expand All @@ -102,7 +101,7 @@ public Flux<ServiceMessage> invokeBidirectional(Publisher<ServiceMessage> publis
return Flux.from(publisher)
.switchOnFirst(
(first, messages) ->
Mono.deferContextual(context -> authenticate(first.get(), context))
Mono.deferContextual(context -> authenticate(first.get(), (Context) context))
.flatMapMany(authData -> deferWithContextBidirectional(messages, authData))
.map(
response ->
Expand Down Expand Up @@ -156,7 +155,7 @@ private Object[] prepareArguments(Object request) {
return arguments;
}

private Mono<Object> authenticate(ServiceMessage message, ContextView context) {
private Mono<Object> authenticate(ServiceMessage message, Context context) {
if (!methodInfo.isSecured()) {
return Mono.just(NULL_AUTH_CONTEXT);
}
Expand Down

0 comments on commit 37a5c17

Please sign in to comment.