Skip to content

Commit

Permalink
Update SecurityConfig.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashmerino committed Nov 23, 2024
1 parent 15de895 commit 39286e0
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ public class SecurityConfig {
"/swagger-ui/**"
};

/**
* Endpoints for Actuator.
*/
private static final String[] ACTUATOR_WHITELIST = {
"/actuator/**",
"/actuator/health",
"/actuator/info"
};

/**
* Regex for all the endpoints related to authentication/authorization.
*/
Expand Down Expand Up @@ -150,6 +159,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(HttpMethod.DELETE, PRODUCTS_ALL_ENDPOINTS).hasAuthority(Role.SELLER.name())
.requestMatchers(HttpMethod.GET, CATEGORIES_ALL_ENDPOINTS).hasAnyAuthority(Role.SELLER.name(), Role.USER.name())
.requestMatchers(SWAGGER_WHITELIST).permitAll()
.requestMatchers(ACTUATOR_WHITELIST).permitAll()
.anyRequest()
.authenticated())
.httpBasic();
Expand Down

0 comments on commit 39286e0

Please sign in to comment.