@Test public void createGame_BaseAuth_User_Forbidden() { List<User> users = webClient .get() .uri(USERS_URL) .headers(basicAuthHeaders(testConfig.getAdminName(), testConfig.getAdminPassword())) .retrieve() .bodyToFlux(User.class) .collect(Collectors.toList()) .block(); assertNotNull(users); assertTrue(users.size() > 3); webTestClient .post() .uri(GAME_URL) .body(BodyInserters.fromObject(createGame(users.get(0), users.get(1)))) .headers(basicAuthHeaders(testConfig.getUserName(), testConfig.getUserPassword())) .exchange() .expectStatus().isForbidden(); }
@PostMapping("game") public Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest) { return webApiService.createGame(gameRequest); }
WebApiUrlProtectedController { @PostMapping("game") public Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest) { return webApiService.createGame(gameRequest); } }
WebApiUrlProtectedController { @PostMapping("game") public Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest) { return webApiService.createGame(gameRequest); } WebApiUrlProtectedController(WebApiService webApiService); }
WebApiUrlProtectedController { @PostMapping("game") public Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest) { return webApiService.createGame(gameRequest); } WebApiUrlProtectedController(WebApiService webApiService); @GetMapping("games") Flux<Game> getAllGames(); @PostMapping("game") Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest); }
WebApiUrlProtectedController { @PostMapping("game") public Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest) { return webApiService.createGame(gameRequest); } WebApiUrlProtectedController(WebApiService webApiService); @GetMapping("games") Flux<Game> getAllGames(); @PostMapping("game") Mono<Game> createGame(@RequestBody Map<String, Object> gameRequest);  }