Refactor resource handlers and update security configuration for media access
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 205 KiB |
@@ -12,6 +12,8 @@ public class MvcConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
registry.addResourceHandler("/public/**").addResourceLocations(resourceLocations);
|
//registry.addResourceHandler("/public/**").addResourceLocations(resourceLocations);
|
||||||
|
// registry.addResourceHandler("/media/**").addResourceLocations("resources/main/public/media/");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
/*
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class NotFoundHandler {
|
public class NotFoundHandler {
|
||||||
@@ -32,4 +33,4 @@ public class NotFoundHandler {
|
|||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There was an error completing the action.");
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There was an error completing the action.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public class WebSecurityConfig {// extends WebSecurityConfigurerAdapter {
|
|||||||
.authorizeHttpRequests(auth ->
|
.authorizeHttpRequests(auth ->
|
||||||
auth.requestMatchers("/api/auth/**").permitAll()
|
auth.requestMatchers("/api/auth/**").permitAll()
|
||||||
.requestMatchers("/*", "/home", "/resources/**").permitAll()
|
.requestMatchers("/*", "/home", "/resources/**").permitAll()
|
||||||
|
.requestMatchers("/resources/public/media/**").permitAll()
|
||||||
|
.requestMatchers("/media/**").permitAll()
|
||||||
.requestMatchers("/api/test/**").permitAll()
|
.requestMatchers("/api/test/**").permitAll()
|
||||||
.requestMatchers("/api/tutorials").permitAll()
|
.requestMatchers("/api/tutorials").permitAll()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user