Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/org/runimo/runimo/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
public class SecurityConfig {

private final JwtAuthenticationFilter jwtAuthenticationFilter;
private final AuthenticationFailureHandler customAuthenticationFailureHandler;

@Bean
@Profile({"prod", "test"})
Expand All @@ -31,6 +30,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
)
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/api/v1/auth/**").permitAll()
.requestMatchers(("/error")).permitAll()
.anyRequest().authenticated()
)
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
Expand All @@ -49,8 +49,10 @@ public SecurityFilterChain devSecurityFilterChain(HttpSecurity http) throws Exce
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/api/v1/auth/**").permitAll()
.requestMatchers("/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**").permitAll()
.requestMatchers(("/error")).permitAll()
.anyRequest().authenticated()
);
)
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);

return http.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,11 @@ public ResponseEntity<ErrorResponse> handleRuntimeException(RuntimeException e)
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(
ErrorResponse.of("internal server error", e.getMessage()));
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handleException(Exception e) {
log.error("{} {}", ERROR_LOG_HEADER, e.getMessage(), e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(
ErrorResponse.of("internal server error", "internal server error"));
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/runimo/runimo/configs/TestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class TestConfig {

@Bean
public JwtTokenFactory jwtTokenFactory() {
return new JwtTokenFactory("testSecret", 1000L, 3600L, 600L);
return new JwtTokenFactory("testSecret", 100000L, 360000L, 60000L);
}

@Bean
Expand Down