Compare commits
No commits in common. "feature/test" and "master" have entirely different histories.
feature/te
...
master
@ -20,7 +20,7 @@ COPY eeg_frontend/openapi.yaml ./
|
|||||||
RUN npx openapi-generator-cli generate -i ./openapi.yaml -g typescript-angular -o ./src/app/api
|
RUN npx openapi-generator-cli generate -i ./openapi.yaml -g typescript-angular -o ./src/app/api
|
||||||
|
|
||||||
COPY eeg_frontend/ ./
|
COPY eeg_frontend/ ./
|
||||||
RUN npm run build -- --configuration staging
|
RUN npm run build -- --configuration production
|
||||||
|
|
||||||
# ---- Stage 2: Build Spring Boot Backend ----
|
# ---- Stage 2: Build Spring Boot Backend ----
|
||||||
FROM maven:3.9-eclipse-temurin-21 AS backend-build
|
FROM maven:3.9-eclipse-temurin-21 AS backend-build
|
||||||
@ -65,8 +65,12 @@ USER eeg
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
||||||
|
CMD curl -f http://localhost:8080/actuator/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["java", \
|
ENTRYPOINT ["java", \
|
||||||
"-XX:+UseContainerSupport", \
|
"-XX:+UseContainerSupport", \
|
||||||
"-XX:MaxRAMPercentage=75.0", \
|
"-XX:MaxRAMPercentage=75.0", \
|
||||||
"-Djava.security.egd=file:/dev/./urandom", \
|
"-Djava.security.egd=file:/dev/./urandom", \
|
||||||
"-jar", "app.jar"]
|
"-jar", "app.jar", \
|
||||||
|
"--spring.profiles.active=prod"]
|
||||||
|
|||||||
@ -28,4 +28,4 @@ foreach ($f in $Files) {
|
|||||||
"`n" | Out-File -Append $OutFile -Encoding UTF8
|
"`n" | Out-File -Append $OutFile -Encoding UTF8
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Erfolgreich! Der Kontext für Backend und Frontend wurde in '$OutFile' gespeichert.."
|
Write-Host "Erfolgreich! Der Kontext für Backend und Frontend wurde in '$OutFile' gespeichert."
|
||||||
@ -23,7 +23,6 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
|
|||||||
import org.springframework.security.oauth2.jwt.NimbusJwtEncoder;
|
import org.springframework.security.oauth2.jwt.NimbusJwtEncoder;
|
||||||
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
|
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
|
||||||
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
|
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
|
||||||
import org.springframework.security.oauth2.server.resource.web.HeaderBearerTokenResolver;
|
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.CorsConfigurationSource;
|
import org.springframework.web.cors.CorsConfigurationSource;
|
||||||
@ -31,6 +30,7 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|||||||
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@ -62,7 +62,6 @@ public class SecurityConfig {
|
|||||||
.anyRequest().denyAll()
|
.anyRequest().denyAll()
|
||||||
)
|
)
|
||||||
.oauth2ResourceServer(oauth2 -> oauth2
|
.oauth2ResourceServer(oauth2 -> oauth2
|
||||||
.bearerTokenResolver(new HeaderBearerTokenResolver("X-Access-Token"))
|
|
||||||
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtAuthenticationConverter()))
|
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtAuthenticationConverter()))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ public class SecurityConfig {
|
|||||||
CorsConfiguration configuration = new CorsConfiguration();
|
CorsConfiguration configuration = new CorsConfiguration();
|
||||||
configuration.setAllowedOrigins(Arrays.stream(corsOrigins.split(",")).map(String::trim).toList());
|
configuration.setAllowedOrigins(Arrays.stream(corsOrigins.split(",")).map(String::trim).toList());
|
||||||
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
|
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
|
||||||
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type", "X-Access-Token"));
|
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type"));
|
||||||
configuration.setAllowCredentials(true);
|
configuration.setAllowCredentials(true);
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
source.registerCorsConfiguration("/**", configuration);
|
source.registerCorsConfiguration("/**", configuration);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ spring:
|
|||||||
jwt:
|
jwt:
|
||||||
secret: dev-only-secret-do-not-use-in-production-2025
|
secret: dev-only-secret-do-not-use-in-production-2025
|
||||||
app:
|
app:
|
||||||
cors-origins: http://localhost:4200,https://preview.coolify.mueller-dev.com
|
cors-origins: http://localhost:4200
|
||||||
eda:
|
eda:
|
||||||
simulation:
|
simulation:
|
||||||
consent-delay-ms: 3000
|
consent-delay-ms: 3000
|
||||||
|
|||||||
@ -48,15 +48,6 @@
|
|||||||
],
|
],
|
||||||
"outputHashing": "all"
|
"outputHashing": "all"
|
||||||
},
|
},
|
||||||
"staging": {
|
|
||||||
"fileReplacements": [
|
|
||||||
{
|
|
||||||
"replace": "src/environments/environment.ts",
|
|
||||||
"with": "src/environments/environment.staging.ts"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputHashing": "all"
|
|
||||||
},
|
|
||||||
"development": {
|
"development": {
|
||||||
"optimization": false,
|
"optimization": false,
|
||||||
"extractLicenses": false,
|
"extractLicenses": false,
|
||||||
@ -71,9 +62,6 @@
|
|||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "eeg_frontend:build:production"
|
"buildTarget": "eeg_frontend:build:production"
|
||||||
},
|
},
|
||||||
"staging": {
|
|
||||||
"buildTarget": "eeg_frontend:build:staging"
|
|
||||||
},
|
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "eeg_frontend:build:development"
|
"buildTarget": "eeg_frontend:build:development"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,14 @@ import {HttpInterceptorFn} from '@angular/common/http';
|
|||||||
export const jwtInterceptor: HttpInterceptorFn = (req, next) => {
|
export const jwtInterceptor: HttpInterceptorFn = (req, next) => {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
|
|
||||||
|
// If a token exists, clone the request and add the Authorization header
|
||||||
if (token) {
|
if (token) {
|
||||||
const authReq = req.clone({
|
const clonedRequest = req.clone({
|
||||||
headers: req.headers.set('X-Access-Token', token)
|
setHeaders: {
|
||||||
|
Authorization: `Bearer ${token}`
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return next(authReq);
|
return next(clonedRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next(req);
|
return next(req);
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
export const environment = {
|
|
||||||
production: false,
|
|
||||||
apiUrl: 'https://preview.coolify.mueller-dev.com'
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue
Block a user