Skip to content

Commit 3da88f4

Browse files
committed
Correct Windows frontend adapter execution contract
1 parent 77f4e3d commit 3da88f4

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/windows/WindowsFrontendAdapter.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@ public WindowsFrontendAdapter(WindowsExecution execution) {
1616
this.execution = Objects.requireNonNull(execution, "execution");
1717
}
1818

19-
public CompletionStage<WindowsExecution.Result> accept(WindowsCall call) {
19+
public CompletionStage<WindowsExecution.WindowsExecutionResult> accept(WindowsCall call) {
2020
Objects.requireNonNull(call, "call");
21-
return CompletableFuture.supplyAsync(() -> execution.execute(call));
21+
if (!execution.program().equals(call.program())
22+
|| !execution.directive().equals(call.directive())
23+
|| !execution.citizen().equals(call.citizen())) {
24+
return CompletableFuture.failedStage(
25+
new SecurityException("Windows call does not match the configured execution context"));
26+
}
27+
return CompletableFuture.supplyAsync(() -> {
28+
try {
29+
return execution.execute();
30+
} catch (Exception e) {
31+
throw new RuntimeException("Windows execution failed", e);
32+
}
33+
});
2234
}
2335
}

0 commit comments

Comments
 (0)