Skip to content

Commit

Permalink
Fix: Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
FarukBraimo committed Jun 19, 2024
1 parent 826a04d commit 9326871
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/**"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")}),
Expand All @@ -42,7 +41,7 @@ public ResponseEntity<InsightResponse> 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")}),
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/vodacom/falcon/service/TokenService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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"));
}
}

0 comments on commit 9326871

Please sign in to comment.