Refactor and secure backend configuration, DTOs, and authentication flow
- Updated pom.xml: removed redundant tags, grouped dependencies, added scopes, and upgraded plugins
- Enhanced RegisterUserDto with validation annotations and added missing fields (username, fullname)
- Updated User entity with builder constructor and removed redundant getters/setters
- Completed FileMetadata entity with Lombok and required setters/getters
- Improved HDFSConfig with correct annotation and clearer exception message
- Adjusted HTTP to HTTPS redirect port (8085 -> 8443)
- Allowed /actuator/** in SecurityConfig and disabled deprecated XSS protection
- Skipped JWT filter for /api/auth and /actuator paths
- Refactored AuthenticationService to use builder pattern and RSA key injection
- Fixed application.properties for static MySQL connection (removed ${MYSQL_PASSWORD})
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.skycrate.backend.skycrateBackend.config;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.conf.Configuration; // Hadoop Configuration
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -8,20 +8,17 @@ import org.springframework.context.annotation.Bean;
|
||||
import java.net.URI;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
// HDFS configuration bean to securely connect to a remote Hadoop cluster.
|
||||
@Configuration
|
||||
@org.springframework.context.annotation.Configuration
|
||||
public class HDFSConfig {
|
||||
|
||||
private static final String HDFS_URI = System.getenv("HDFS_URI"); // export HDFS_URI=hdfs://192.168.29.30:9000
|
||||
private static final String HDFS_USER = System.getenv("HDFS_USER"); // Hadoop user (if needed)
|
||||
private static final String HDFS_URI = System.getenv("HDFS_URI"); // e.g., hdfs://namenode:9000
|
||||
private static final String HDFS_USER = System.getenv("HDFS_USER"); // e.g., hdfsuser
|
||||
|
||||
// Configures and returns a secured HDFS FileSystem instance.
|
||||
@Bean
|
||||
public FileSystem fileSystem() throws Exception {
|
||||
return getHDFS(); // use the static method internally
|
||||
return getHDFS();
|
||||
}
|
||||
|
||||
// Static method to get a FileSystem instance. Used by other classes like HDFSController.
|
||||
public static FileSystem getHDFS() throws Exception {
|
||||
if (HDFS_URI == null || HDFS_URI.isBlank()) {
|
||||
throw new IllegalStateException("HDFS_URI environment variable not set.");
|
||||
|
||||
Reference in New Issue
Block a user