Skip to content

Commit d84e18d

Browse files
author
Dominik Grenz
committed
Merge branch 'main' into MUXDBS-101-adjustments
2 parents 70667b6 + fc543a1 commit d84e18d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1133
-73
lines changed

.github/workflows/codeql.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ jobs:
5151
strategy:
5252
fail-fast: false
5353
matrix:
54-
build-path: ["./personalization-service", "./ticketing-eventing/eventing-service"] # JSON array formatted as string, contains the paths to the java projects to build
54+
# paths to the java projects to build
55+
build-path:
56+
- "./personalization-service"
57+
- "./ticketing-eai/api-client-internal"
58+
- "./ticketing-eventing/eventing-service"
59+
- "./ticketing-eventing/handler-core"
60+
- "./ticketing-eventing/mail-handler-service"
5561
steps:
5662
- uses: it-at-m/lhm_actions/action-templates/actions/action-codeql@9767179088fd2e344d1a24c17404ab809a60f1b6 # v1.0.20
5763
if: ${{ env.analyze-java == 'true' && (github.ref_name == 'main' || needs.check-changes.outputs.java == 'true') }}

.github/workflows/maven-node-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
build-image: true
2626
- app-path: ticketing-eventing/handler-core
2727
build-image: false
28+
- app-path: ticketing-eventing/mail-handler-service
29+
build-image: true
2830

2931
steps:
3032
- uses: it-at-m/lhm_actions/action-templates/actions/action-checkout@9767179088fd2e344d1a24c17404ab809a60f1b6 # v1.0.20

.github/workflows/maven-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
- ticketing-eai/api-client-internal
2121
- ticketing-eventing/eventing-service
2222
- ticketing-eventing/handler-core
23+
- ticketing-eventing/mail-handler-service
2324

2425
jobs:
2526
release-maven:
@@ -68,4 +69,3 @@ jobs:
6869
artifact-name: ${{ needs.release-maven.outputs.ARTIFACT_NAME }}
6970
tag-name: ${{ inputs.app-path }}-${{ github.event.inputs.releaseVersion }}
7071
artifact-path: ${{ github.event.inputs.app-path }}/target/*.jar
71-

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,3 @@ nbdist/
185185
*.njsproj
186186
*.sln
187187
*.sw?
188-
189-
out
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="DbsTicketingEventingMailHandlerService" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
3+
<option name="ACTIVE_PROFILES" value="local" />
4+
<module name="mail-handler-service" />
5+
<option name="SPRING_BOOT_MAIN_CLASS" value="de.muenchen.oss.dbs.ticketing.eventing.mailhandler.DbsTicketingEventingMailHandlerService" />
6+
<extension name="net.ashald.envfile">
7+
<option name="IS_ENABLED" value="false" />
8+
<option name="IS_SUBST" value="false" />
9+
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
10+
<option name="IS_IGNORE_MISSING_FILES" value="false" />
11+
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
12+
<ENTRIES>
13+
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
14+
</ENTRIES>
15+
</extension>
16+
<method v="2">
17+
<option name="Make" enabled="true" />
18+
</method>
19+
</configuration>
20+
</component>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package de.muenchen.dbs.personalization.configuration;
2+
3+
import jakarta.validation.constraints.NotBlank;
4+
import lombok.Data;
5+
import org.springframework.boot.context.properties.ConfigurationProperties;
6+
import org.springframework.context.annotation.Profile;
7+
import org.springframework.validation.annotation.Validated;
8+
9+
@ConfigurationProperties(prefix = "p13n")
10+
@Validated
11+
@Profile("!no-security")
12+
@Data
13+
public class P13nConfiguration {
14+
/**
15+
* ServiceNavigator API URL.
16+
*/
17+
@NotBlank
18+
private String serviceNavigatorUrl = "https://stadt.muenchen.de/service/rs/befi/navigator";
19+
20+
/**
21+
* (optional) Proxy Host used to call ServiceNavigator.
22+
*/
23+
private String proxyHost = null;
24+
25+
/**
26+
* (optional) Proxy Port used to call ServiceNavigator.
27+
*/
28+
private int proxyPort = 80;
29+
30+
}

personalization-service/src/main/java/de/muenchen/dbs/personalization/configuration/SecurityConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception
5252
// allow access to swagger-ui
5353
PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, "/swagger-ui/**"),
5454
// allow access to /actuator/metrics for Prometheus monitoring in OpenShift
55-
PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, "/actuator/metrics"))
55+
PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, "/actuator/metrics"),
56+
PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, "/public/**"))
5657
.permitAll())
5758
.authorizeHttpRequests((requests) -> requests.requestMatchers("/**")
5859
.authenticated())
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package de.muenchen.dbs.personalization.servicenavigator;
2+
3+
import de.muenchen.dbs.personalization.configuration.P13nConfiguration;
4+
import io.swagger.v3.oas.annotations.Operation;
5+
import io.swagger.v3.oas.annotations.tags.Tag;
6+
import java.net.InetSocketAddress;
7+
import java.net.Proxy;
8+
import java.util.List;
9+
import lombok.RequiredArgsConstructor;
10+
import lombok.extern.slf4j.Slf4j;
11+
import org.apache.commons.lang3.StringUtils;
12+
import org.springframework.beans.factory.annotation.Autowired;
13+
import org.springframework.http.HttpStatus;
14+
import org.springframework.http.ResponseEntity;
15+
import org.springframework.http.client.SimpleClientHttpRequestFactory;
16+
import org.springframework.web.bind.annotation.GetMapping;
17+
import org.springframework.web.bind.annotation.RequestMapping;
18+
import org.springframework.web.bind.annotation.RequestParam;
19+
import org.springframework.web.bind.annotation.ResponseStatus;
20+
import org.springframework.web.bind.annotation.RestController;
21+
import org.springframework.web.client.RestTemplate;
22+
23+
@RestController
24+
@RequestMapping("/public/servicenavigator")
25+
@Slf4j
26+
@RequiredArgsConstructor
27+
@Tag(name = "Public ServiceNavigator Endpoints", description = "Endpoints not requiring authentication")
28+
public class PublicServiceNavigatorController {
29+
30+
private static final String SERVICENAVIGATOR_QUERY_PARAMETER_ID = "?id=";
31+
32+
private final RestTemplate restTemplate;
33+
private final P13nConfiguration p13nConfiguration;
34+
35+
@Autowired
36+
public PublicServiceNavigatorController(final P13nConfiguration p13nConfiguration) {
37+
this.p13nConfiguration = p13nConfiguration;
38+
39+
if (StringUtils.isBlank(p13nConfiguration.getProxyHost())) {
40+
this.restTemplate = new RestTemplate();
41+
} else {
42+
final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(p13nConfiguration.getProxyHost(), p13nConfiguration.getProxyPort()));
43+
final SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
44+
requestFactory.setProxy(proxy);
45+
this.restTemplate = new RestTemplate(requestFactory);
46+
}
47+
}
48+
49+
@GetMapping
50+
@Operation(summary = "Lookup ServiceNavigator Services by ServiceID. Returns a list of services for the given service IDs.")
51+
@ResponseStatus(HttpStatus.OK)
52+
public List<Object> getServicesByIds(@RequestParam("ids") final String serviceIds) {
53+
final String url = p13nConfiguration.getServiceNavigatorUrl() + SERVICENAVIGATOR_QUERY_PARAMETER_ID + serviceIds;
54+
final ResponseEntity<List> forEntity = restTemplate.getForEntity(url, List.class);
55+
return forEntity.getBody();
56+
}
57+
58+
}

personalization-service/src/main/resources/application-local.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@ sso:
4242

4343
security:
4444
user-info-uri: ${sso.url}/auth/realms/${sso.realm}/protocol/openid-connect/userinfo
45-
logging-mode: all
45+
logging-mode: all
46+
47+
p13n:
48+
service-navigator-url: "https://stadt.muenchen.de/service/rs/befi/navigator/"
49+
proxy-host: "internet-proxy-client.muenchen.de"
50+
proxy-port: 80

personalization-service/src/test/java/de/muenchen/dbs/personalization/IntegrationTestBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import static de.muenchen.dbs.personalization.TestConstants.SPRING_TEST_PROFILE;
55

66
import com.fasterxml.jackson.databind.ObjectMapper;
7+
import de.muenchen.dbs.personalization.configuration.P13nConfiguration;
78
import java.time.Instant;
89
import java.util.Map;
910
import org.springframework.beans.factory.annotation.Autowired;
11+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
1012
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1113
import org.springframework.boot.test.context.SpringBootTest;
1214
import org.springframework.security.oauth2.jwt.Jwt;
@@ -19,6 +21,7 @@
1921
classes = { PersonalizationServiceApplication.class },
2022
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
2123
)
24+
@EnableConfigurationProperties(P13nConfiguration.class)
2225
@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
2326
@AutoConfigureMockMvc
2427
public class IntegrationTestBase {

0 commit comments

Comments
 (0)