Skip to content

Commit

Permalink
feature(chore):786 added alternative port for internal access only.
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-mwesener committed Jul 1, 2024
1 parent 7627515 commit b633d30
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
@EnableJpaRepositories(basePackages = "org.eclipse.tractusx.traceability.*")
public class ApplicationConfig {

public static String APPLICATION_PATH = "/api";
public static String INTERNAL_ENDPOINT = "/internal";

@Bean
public InternalResourceViewResolver defaultViewResolver() {
return new InternalResourceViewResolver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public class SecurityConfig {
"/v3/api-docs/**",
"/swagger-ui/**",
"/webjars/swagger-ui/**",
"/qualitynotifications/receive",
"/qualityalerts/receive",
"/qualitynotifications/update",
"/qualityalerts/update",
"/internal/qualitynotifications/receive",
"/internal/qualityalerts/receive",
"/internal/qualitynotifications/update",
"/internal/qualityalerts/update",
"/callback/endpoint-data-reference",
"/internal/endpoint-data-reference",
"/actuator/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public void doFilter(final ServletRequest servletRequest, final ServletResponse
private boolean isRequestForTrustedEndpoint(final ServletRequest servletRequest) {
log.warn(((HttpServletRequestWrapper) servletRequest).getRequestURI());
return ((HttpServletRequestWrapper) servletRequest).getRequestURI()
.startsWith("/api/" + ApiConstants.API_PREFIX_INTERNAL);
.startsWith(ApplicationConfig.APPLICATION_PATH + ApplicationConfig.INTERNAL_ENDPOINT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
********************************************************************************/
package org.eclipse.tractusx.traceability.notification.domain.contract;

import org.eclipse.tractusx.traceability.common.config.ApplicationConfig;
import policies.response.PolicyResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -155,6 +156,6 @@ private void revertNotificationAsset(String notificationAssetId) {

private String createBaseUrl(org.eclipse.tractusx.traceability.notification.application.contract.model.NotificationType notificationType, NotificationMethod notificationMethod) {
final String template = notificationType.equals(org.eclipse.tractusx.traceability.notification.application.contract.model.NotificationType.QUALITY_ALERT) ? TRACE_FOSS_QUALITY_NOTIFICATION_ALERT_URL_TEMPLATE : TRACE_FOSS_QUALITY_NOTIFICATION_INVESTIGATION_URL_TEMPLATE;
return traceabilityProperties.getUrl() + template.formatted(notificationMethod.getValue());
return traceabilityProperties.getUrl() + ApplicationConfig.INTERNAL_ENDPOINT + template.formatted(notificationMethod.getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.eclipse.tractusx.traceability.common.model.SecurityUtils.sanitize;
Expand All @@ -47,6 +48,7 @@
@RestController
@Validated
@RequiredArgsConstructor
@RequestMapping(path = "/internal")
public class EdcController {

private final NotificationReceiverService notificationReceiverService;
Expand Down

0 comments on commit b633d30

Please sign in to comment.