Skip to content

Commit

Permalink
Restore authorization context for live response enforcement in Concie…
Browse files Browse the repository at this point in the history
…rge.

Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Nov 15, 2021
1 parent 19aaa47 commit 56bca4b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected CompletionStage<R> askAndBuildJsonView(
.thenApply(response -> filterJsonView(response, enforcer));
}

@SuppressWarnings("unchecked")
protected CompletionStage<R> askAndBuildJsonView(
final ActorRef actorToAsk,
final C commandWithReadSubjects,
Expand All @@ -82,7 +83,12 @@ protected CompletionStage<R> askAndBuildJsonView(
final Executor executor) {

return ask(actorToAsk, commandWithReadSubjects, publish, "before building JsonView", scheduler, executor)
.thenApply(response -> filterJsonView(response, enforcer));
.thenApply(response -> filterJsonView((R) response.setDittoHeaders(
response.getDittoHeaders()
.toBuilder()
.authorizationContext(commandWithReadSubjects.getDittoHeaders().getAuthorizationContext())
.build()
), enforcer));
}

/**
Expand Down

0 comments on commit 56bca4b

Please sign in to comment.