Skip to content

Commit

Permalink
fix: authentication to some routes
Browse files Browse the repository at this point in the history
Signed-off-by: MatheusVict <[email protected]>
  • Loading branch information
MatheusVict committed Mar 7, 2024
1 parent 46b5752 commit 2ddc273
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws
.requestMatchers(ACTUATOR_WHITELIST).permitAll()
.requestMatchers(HttpMethod.POST, "/auth/login").permitAll()
.requestMatchers("/api/v1/user/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.GET, "/api/v1/posts/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/v1/files/**").permitAll()
.requestMatchers(HttpMethod.POST, "/api/v1/files/upload").hasRole("ADMIN")
.requestMatchers(HttpMethod.POST, "/api/v1/posts/").hasRole("ADMIN")
.requestMatchers(HttpMethod.PUT, "/api/v1/posts/**").hasRole("ADMIN")
.requestMatchers(HttpMethod.DELETE, "/api/v1/posts/**").hasRole("ADMIN")
.requestMatchers("/api/v1/user/**").hasRole("ADMIN")
.anyRequest().authenticated()
)
.addFilterBefore(securtityFilter, UsernamePasswordAuthenticationFilter.class)
Expand Down

0 comments on commit 2ddc273

Please sign in to comment.