Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@
"onAutoForward": "ignore"
}
},
"otherPortsAttributes": {"onAutoForward": "ignore"}
"otherPortsAttributes": {"onAutoForward": "ignore"},
"shutdownAction": "none",
"mounts": [
"source=/data/home/akumar87/.m2,target=/home/vscode/.m2,type=bind,consistency=consistent",
"source=/data/home/akumar87/codebase/bitbucket/api-gateway-custom-plugin,target=/workspaces/api-gateway-custom-plugin,type=bind,consistency=cached",
"source=/data/home/akumar87/codebase/scripts/,target=/workspaces/scripts,type=bind,consistency=cached",
"source=/data/home/akumar87/codebase/ecsp/token-validator,target=/workspaces/token-validator,type=bind,consistency=cached",
"source=/data/home/akumar87/codebase/harman-auto/sp-platform-productenablers-api-gateway-test,target=/workspaces/sp-platform-productenablers-api-gateway-test,type=bind,consistency=cached"
]
}
8 changes: 8 additions & 0 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@ jobs:
with:
context_path: ./api-gateway
maven_args: 'clean package --file pom.xml'
java_version: '25'
java_distribution: 'temurin'

deploy-snapshot:
uses: eclipse-ecsp/.github/.github/workflows/workflow-publish-artifacts.yml@52c11f63f46f741e4f56c5dace97b44982a4372b
secrets: inherit
needs: sonar_analysis
with:
java_version: '25'
java_distribution: 'temurin'
69 changes: 0 additions & 69 deletions .github/workflows/maven-deploy.yml

This file was deleted.

251 changes: 127 additions & 124 deletions DEPENDENCIES

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>api-gateway-parent</artifactId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
</parent>

<artifactId>api-gateway</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import org.eclipse.ecsp.gateway.utils.ObjectMapperUtil;
import org.eclipse.ecsp.utils.logger.IgniteLogger;
import org.eclipse.ecsp.utils.logger.IgniteLoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.endpoint.EndpointFilter;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.WebProperties;
import org.springframework.boot.http.codec.CodecCustomizer;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.boot.web.server.autoconfigure.ServerProperties;
import org.springframework.cloud.circuitbreaker.resilience4j.ReactiveResilience4JCircuitBreakerFactory;
Expand All @@ -46,6 +48,7 @@
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.unit.DataSize;
import org.springframework.web.client.RestClientException;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
Expand Down Expand Up @@ -297,4 +300,10 @@ public RetryTemplate routesRefreshRetryTemplate(RouteRefreshProperties propertie
return retryTemplate;
}

//@Bean
public CodecCustomizer codecCustomizer(@Value("${spring.codec.max-in-memory-size:1MB}") String maxInMemorySize) {
int maxInMemorySizeBytes = (int) DataSize.parse(maxInMemorySize).toBytes();
return configurer -> configurer.defaultCodecs().maxInMemorySize(maxInMemorySizeBytes);
}

}
12 changes: 11 additions & 1 deletion api-registry-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>api-gateway-parent</artifactId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
</parent>

<artifactId>api-registry-common</artifactId>
Expand Down Expand Up @@ -77,5 +77,15 @@
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.ecsp</groupId>
<artifactId>token-validator</artifactId>
<version>${ecsp.token-validator.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,44 @@
package org.eclipse.ecsp.config;

import org.eclipse.ecsp.interceptors.HeaderInterceptor;
import org.eclipse.ecsp.interceptors.TokenValidationInterceptor;
import org.eclipse.ecsp.utils.logger.IgniteLogger;
import org.eclipse.ecsp.utils.logger.IgniteLoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Optional;

/**
* InterceptorConfig.
*/
@Configuration
@Order(10)
public class InterceptorConfig implements WebMvcConfigurer {

private static final IgniteLogger LOGGER = IgniteLoggerFactory.getLogger(InterceptorConfig.class);
private final HeaderInterceptor headerInterceptor;
private final Optional<TokenValidationInterceptor> tokenValidationInterceptor;

/**
* Constructor to initialize the InterceptorConfig.
*
* @param headerInterceptor the HeaderInterceptor
* @param headerInterceptor the HeaderInterceptor
* @param tokenValidationInterceptor the optional TokenValidationInterceptor
*/
public InterceptorConfig(HeaderInterceptor headerInterceptor) {
public InterceptorConfig(HeaderInterceptor headerInterceptor,
Optional<TokenValidationInterceptor> tokenValidationInterceptor) {
this.headerInterceptor = headerInterceptor;
this.tokenValidationInterceptor = tokenValidationInterceptor;
}

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(headerInterceptor);
LOGGER.debug("Added HeaderInterceptor to the interceptor registry");
tokenValidationInterceptor.ifPresent(interceptor -> {
registry.addInterceptor(interceptor);
LOGGER.debug("Added TokenValidationInterceptor to the interceptor registry");
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
* <p>SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.ecsp.restclient;
package org.eclipse.ecsp.config;

import org.eclipse.ecsp.restclient.RestTemplateErrorHandler;
import org.eclipse.ecsp.restclient.RestTemplateLogInterceptor;
import org.eclipse.ecsp.restclient.RestTemplateTokenInterceptor;
import org.eclipse.ecsp.utils.logger.IgniteLogger;
import org.eclipse.ecsp.utils.logger.IgniteLoggerFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -44,16 +48,24 @@ public RestTemplateConfig() {
/**
* Create and returns the object of RestTemplate.
*
* <p>If a {@link RestTemplateTokenInterceptor} bean is available it is added to the
* interceptor chain so that Bearer tokens are forwarded to downstream services.
*
* @param tokenInterceptorProvider provider for the optional token propagation interceptor
* @return RestTemplate Object
*/
@Bean
@ConditionalOnMissingBean
public RestTemplate restTemplate() {
public RestTemplate restTemplate(ObjectProvider<RestTemplateTokenInterceptor> tokenInterceptorProvider) {
RestTemplate restTemplate = new RestTemplate();
restTemplate.setErrorHandler(new RestTemplateErrorHandler());
if (LOGGER.isDebugEnabled()) {
restTemplate.getInterceptors().add(new RestTemplateLogInterceptor());
}
RestTemplateTokenInterceptor tokenInterceptor = tokenInterceptorProvider.getIfAvailable();
if (tokenInterceptor != null) {
restTemplate.getInterceptors().add(tokenInterceptor);
}
return restTemplate;
}

Expand Down
Loading
Loading