mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 22:21:09 +08:00
Add category module and require post category
This commit is contained in:
@@ -68,6 +68,9 @@ public class SecurityConfig {
|
||||
.requestMatchers(HttpMethod.POST, "/api/auth/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/posts/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/comments/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/categories/**").permitAll()
|
||||
.requestMatchers(HttpMethod.POST, "/api/categories/**").hasAuthority("ADMIN")
|
||||
.requestMatchers(HttpMethod.DELETE, "/api/categories/**").hasAuthority("ADMIN")
|
||||
.requestMatchers("/api/admin/**").hasAuthority("ADMIN")
|
||||
.anyRequest().authenticated()
|
||||
)
|
||||
@@ -84,7 +87,7 @@ public class SecurityConfig {
|
||||
String uri = request.getRequestURI();
|
||||
|
||||
boolean publicGet = "GET".equalsIgnoreCase(request.getMethod()) &&
|
||||
(uri.startsWith("/api/posts") || uri.startsWith("/api/comments"));
|
||||
(uri.startsWith("/api/posts") || uri.startsWith("/api/comments") || uri.startsWith("/api/categories"));
|
||||
|
||||
if (authHeader != null && authHeader.startsWith("Bearer ")) {
|
||||
String token = authHeader.substring(7);
|
||||
|
||||
Reference in New Issue
Block a user