diff --git a/src/main/java/com/vodacom/falcon/config/security/SecurityConfig.java b/src/main/java/com/vodacom/falcon/config/security/SecurityConfig.java index 468b59f..7299921 100644 --- a/src/main/java/com/vodacom/falcon/config/security/SecurityConfig.java +++ b/src/main/java/com/vodacom/falcon/config/security/SecurityConfig.java @@ -26,7 +26,7 @@ public class SecurityConfig { private CustomFilter filter; private static final String[] AUTH_WHITELIST = { "falcon/auth/**", - "falcon/insight/", + "falcon/insight", "/v3/api-docs/**", "/swagger-ui/**" }; diff --git a/src/main/java/com/vodacom/falcon/controller/InsightController.java b/src/main/java/com/vodacom/falcon/controller/InsightController.java index d06f05e..5a6eb0a 100644 --- a/src/main/java/com/vodacom/falcon/controller/InsightController.java +++ b/src/main/java/com/vodacom/falcon/controller/InsightController.java @@ -25,12 +25,11 @@ @CrossOrigin(value = "*") @RequiredArgsConstructor @Slf4j -@RequestMapping("falcon/insight") @EnableCaching public class InsightController { private final InsightService falconInsightService; - @GetMapping() + @GetMapping("falcon/insight") @Operation(summary = "Get insight by city", description = "Should return population, gdp, exchange rates, weather forecast. The last 2 if the user is authenticated") @ApiResponses(value = { @ApiResponse(responseCode = "200", content = {@Content(schema = @Schema(implementation = String.class), mediaType = "application/json")}), @@ -42,7 +41,7 @@ public ResponseEntity getInsight(@RequestParam("city") @Valid S return new ResponseEntity<>(response, HttpStatus.OK); } - @GetMapping("/historical") + @GetMapping("falcon/insights/historical") @Operation(summary = "Get historical insights by country", description = "Should return population and gdp from 2012 to 2022 for given country") @ApiResponses(value = { @ApiResponse(responseCode = "200", content = {@Content(schema = @Schema(implementation = String.class), mediaType = "application/json")}), diff --git a/src/main/java/com/vodacom/falcon/service/TokenService.java b/src/main/java/com/vodacom/falcon/service/TokenService.java index 887ff13..131e3bd 100644 --- a/src/main/java/com/vodacom/falcon/service/TokenService.java +++ b/src/main/java/com/vodacom/falcon/service/TokenService.java @@ -21,7 +21,6 @@ public class TokenService { public String generateToken(User user) { try { Algorithm algorithm = Algorithm.HMAC256(key); - return JWT.create() .withIssuer("falcon") .withSubject(user.getUsername()) @@ -48,6 +47,6 @@ public String validateToken(String token) { private Instant getExpirationDate() { - return LocalDateTime.now().plusHours(2).toInstant(ZoneOffset.of("-03:00")); + return LocalDateTime.now().plusHours(24).toInstant(ZoneOffset.of("-03:00")); } }