@Test public void testAuthenticate() { doReturn(true).when(jwtAuthentication).checkPodInfo(CONFIGURATION_ID, POD_ID); doReturn(MOCK_APP_TOKEN).when(jwtAuthentication).authenticate(CONFIGURATION_ID); ResponseEntity result = appAuthenticationResource.authenticate(CONFIGURATION_ID, REQUEST_AUTHENTICATE); assertNotNull(result); assertTrue(result.getBody() instanceof AppToken); AppToken resultToken = (AppToken) result.getBody(); assertEquals(mockAppToken, resultToken); }
@PostMapping(value = "/authenticate") public ResponseEntity authenticate(@PathVariable String configurationId, @RequestBody String body) { JsonNode node = getJsonNode(POD_ID, AUTHENTICATE, body); String podId = node.path(POD_ID).asText(); validateRequiredParameter(podId, POD_ID, AUTHENTICATE); if (!jwtAuthentication.checkPodInfo(configurationId, podId)) { ErrorResponse response = new ErrorResponse(HttpStatus.UNAUTHORIZED.value(), logMessage.getMessage(UNAUTHORIZED_URL, podId)); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response); } String component = getIntegrationComponent(configurationId); String token = jwtAuthentication.authenticate(configurationId); AppToken appToken = new AppToken(component, token, null); return ResponseEntity.ok().body(appToken); }
ApplicationAuthenticationResource { @PostMapping(value = "/authenticate") public ResponseEntity authenticate(@PathVariable String configurationId, @RequestBody String body) { JsonNode node = getJsonNode(POD_ID, AUTHENTICATE, body); String podId = node.path(POD_ID).asText(); validateRequiredParameter(podId, POD_ID, AUTHENTICATE); if (!jwtAuthentication.checkPodInfo(configurationId, podId)) { ErrorResponse response = new ErrorResponse(HttpStatus.UNAUTHORIZED.value(), logMessage.getMessage(UNAUTHORIZED_URL, podId)); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response); } String component = getIntegrationComponent(configurationId); String token = jwtAuthentication.authenticate(configurationId); AppToken appToken = new AppToken(component, token, null); return ResponseEntity.ok().body(appToken); } }
ApplicationAuthenticationResource { @PostMapping(value = "/authenticate") public ResponseEntity authenticate(@PathVariable String configurationId, @RequestBody String body) { JsonNode node = getJsonNode(POD_ID, AUTHENTICATE, body); String podId = node.path(POD_ID).asText(); validateRequiredParameter(podId, POD_ID, AUTHENTICATE); if (!jwtAuthentication.checkPodInfo(configurationId, podId)) { ErrorResponse response = new ErrorResponse(HttpStatus.UNAUTHORIZED.value(), logMessage.getMessage(UNAUTHORIZED_URL, podId)); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response); } String component = getIntegrationComponent(configurationId); String token = jwtAuthentication.authenticate(configurationId); AppToken appToken = new AppToken(component, token, null); return ResponseEntity.ok().body(appToken); }  }
ApplicationAuthenticationResource { @PostMapping(value = "/authenticate") public ResponseEntity authenticate(@PathVariable String configurationId, @RequestBody String body) { JsonNode node = getJsonNode(POD_ID, AUTHENTICATE, body); String podId = node.path(POD_ID).asText(); validateRequiredParameter(podId, POD_ID, AUTHENTICATE); if (!jwtAuthentication.checkPodInfo(configurationId, podId)) { ErrorResponse response = new ErrorResponse(HttpStatus.UNAUTHORIZED.value(), logMessage.getMessage(UNAUTHORIZED_URL, podId)); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response); } String component = getIntegrationComponent(configurationId); String token = jwtAuthentication.authenticate(configurationId); AppToken appToken = new AppToken(component, token, null); return ResponseEntity.ok().body(appToken); }  @PostMapping(value = "/authenticate") ResponseEntity authenticate(@PathVariable String configurationId,
      @RequestBody String body); @PostMapping(value = "/validate") ResponseEntity validate(@PathVariable String configurationId, @RequestBody String body); @PostMapping(value = "/tokens/validate") ResponseEntity validateTokens(@PathVariable String configurationId,
      @RequestBody String body); }
ApplicationAuthenticationResource { @PostMapping(value = "/authenticate") public ResponseEntity authenticate(@PathVariable String configurationId, @RequestBody String body) { JsonNode node = getJsonNode(POD_ID, AUTHENTICATE, body); String podId = node.path(POD_ID).asText(); validateRequiredParameter(podId, POD_ID, AUTHENTICATE); if (!jwtAuthentication.checkPodInfo(configurationId, podId)) { ErrorResponse response = new ErrorResponse(HttpStatus.UNAUTHORIZED.value(), logMessage.getMessage(UNAUTHORIZED_URL, podId)); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(response); } String component = getIntegrationComponent(configurationId); String token = jwtAuthentication.authenticate(configurationId); AppToken appToken = new AppToken(component, token, null); return ResponseEntity.ok().body(appToken); }  @PostMapping(value = "/authenticate") ResponseEntity authenticate(@PathVariable String configurationId,
      @RequestBody String body); @PostMapping(value = "/validate") ResponseEntity validate(@PathVariable String configurationId, @RequestBody String body); @PostMapping(value = "/tokens/validate") ResponseEntity validateTokens(@PathVariable String configurationId,
      @RequestBody String body);  }