Skip to content

Commit

Permalink
simple-microservice-rest-client: review
Browse files Browse the repository at this point in the history
  • Loading branch information
tommaso-borgato committed Nov 29, 2024
1 parent 839dfd5 commit d9fb804
Show file tree
Hide file tree
Showing 23 changed files with 87 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<packaging>war</packaging>
<name>simple-microservice-database</name>
<description>Insert description for your project here.</description>
<description>Simple Microservice using a DB</description>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
Expand All @@ -21,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>5.0.0.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>32.0.0.Final</version.wildfly.bom>
<version.wildfly.maven.plugin>5.0.1.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>34.0.1.Final</version.wildfly.bom>

<!--Use JUnit 5 here - the WildFly bom still brings 4.x -->
<version.junit5>5.10.1</version.junit5>
<version.junit5>5.11.3</version.junit5>

<!-- other plugin versions -->
<version.compiler.plugin>3.13.0</version.compiler.plugin>
Expand All @@ -44,20 +44,6 @@
force it to be used first.
-->
<repositories>
<repository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<releases>
<updatePolicy>never</updatePolicy>
Expand All @@ -72,19 +58,6 @@
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<releases>
</releases>
Expand Down Expand Up @@ -215,10 +188,10 @@
<location>org.wildfly:wildfly-galleon-pack:${version.wildfly.bom}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.0.Final</location>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.2.Final</location>
</feature-pack>
<feature-pack>
<location>org.wildfly:wildfly-datasources-galleon-pack:8.0.0.Final</location>
<location>org.wildfly:wildfly-datasources-galleon-pack:9.1.0.Final</location>
</feature-pack>
</feature-packs>
<layers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<packaging>war</packaging>
<name>simple-microservice-infinispan</name>
<description>Insert description for your project here.</description>
<description>Simple Microservice using Infinispan</description>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
Expand All @@ -21,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>5.0.0.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>32.0.0.Final</version.wildfly.bom>
<version.wildfly.maven.plugin>5.0.1.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>34.0.1.Final</version.wildfly.bom>

<!--Use JUnit 5 here - the WildFly bom still brings 4.x -->
<version.junit5>5.10.1</version.junit5>
<version.junit5>5.11.3</version.junit5>

<!-- other plugin versions -->
<version.compiler.plugin>3.13.0</version.compiler.plugin>
Expand All @@ -44,20 +44,6 @@
force it to be used first.
-->
<repositories>
<repository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<releases>
<updatePolicy>never</updatePolicy>
Expand All @@ -72,19 +58,6 @@
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<releases>
</releases>
Expand Down Expand Up @@ -205,7 +178,7 @@
<location>org.wildfly:wildfly-galleon-pack:${version.wildfly.bom}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.0.Final</location>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.2.Final</location>
</feature-pack>
</feature-packs>
<layers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<packaging>war</packaging>
<name>simple-microservice-jms</name>
<description>Insert description for your project here.</description>
<description>Simple Microservice using JMS</description>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
Expand All @@ -21,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>5.0.0.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>32.0.0.Final</version.wildfly.bom>
<version.wildfly.maven.plugin>5.0.1.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>34.0.1.Final</version.wildfly.bom>

<!--Use JUnit 5 here - the WildFly bom still brings 4.x -->
<version.junit5>5.10.1</version.junit5>
<version.junit5>5.11.3</version.junit5>

<!-- other plugin versions -->
<version.compiler.plugin>3.13.0</version.compiler.plugin>
Expand All @@ -44,20 +44,6 @@
force it to be used first.
-->
<repositories>
<repository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<releases>
<updatePolicy>never</updatePolicy>
Expand All @@ -72,19 +58,6 @@
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<releases>
</releases>
Expand Down Expand Up @@ -215,7 +188,7 @@
<location>org.wildfly:wildfly-galleon-pack:${version.wildfly.bom}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.0.Final</location>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:7.0.2.Final</location>
</feature-pack>
</feature-packs>
<layers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ spec:
labels:
app: keycloak
spec:
volumes:
- name: keycloak-data-import-volume
configMap:
name: keycloak-data-import
containers:
- name: keycloak
image: quay.io/keycloak/keycloak:26.0
args: ["start-dev"]
args: [ "start-dev", "--import-realm" ]
env:
- name: KEYCLOAK_ADMIN
value: "admin"
Expand All @@ -59,4 +63,7 @@ spec:
readinessProbe:
httpGet:
path: /realms/master
port: 8080
port: 8080
volumeMounts:
- name: keycloak-data-import-volume
mountPath: /opt/keycloak/data/import
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ spec:
value: "http://simple-microservice-server-secured-service:8080"
- name: OIDC_PROVIDER_URL
# replace with the outcome of "minikube service keycloak-external --url"
value: "http://192.168.39.190:31950"
value: "http://192.168.39.178:32042"
- name: OIDC_CLIENT_SECRET
value: "KqIQIzNHD9LnCRjsCxblDnfEl4rcNoKB"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<packaging>war</packaging>
<name>simple-microservice-client-secured</name>
<description>Insert description for your project here.</description>
<description>Simple Microservice Client secured</description>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
Expand All @@ -21,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>5.0.0.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>33.0.2.Final</version.wildfly.bom>
<version.wildfly.maven.plugin>5.0.1.Final</version.wildfly.maven.plugin>
<version.wildfly.bom>34.0.1.Final</version.wildfly.bom>

<!--Use JUnit 5 here - the WildFly bom still brings 4.x -->
<version.junit5>5.10.1</version.junit5>
<version.junit5>5.11.3</version.junit5>

<!-- other plugin versions -->
<version.compiler.plugin>3.13.0</version.compiler.plugin>
Expand All @@ -44,20 +44,6 @@
force it to be used first.
-->
<repositories>
<repository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<releases>
<updatePolicy>never</updatePolicy>
Expand All @@ -72,19 +58,6 @@
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Main Apache Maven Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<releases>
</releases>
Expand Down Expand Up @@ -113,7 +86,7 @@

<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-microprofile</artifactId>
<artifactId>wildfly-expansion</artifactId>
<version>${version.wildfly.bom}</version>
<type>pom</type>
<scope>import</scope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class GettingStartedEndpoint {

@Inject
@RestClient
private GettingStartedEndpointInterface service;
private GettingStartedEndpointClient client;

@GET
@Path("/{name}")
Expand All @@ -37,10 +37,10 @@ public Response sayHello(final @PathParam("name") String name) throws IOExceptio
if (oidcSecurityContext != null) {
String authzHeaderValue = "Bearer " + oidcSecurityContext.getTokenString();
System.out.println("\n\n[JWT] service Token: " + authzHeaderValue + "\n\n");
return service.sayHello(authzHeaderValue, name);
return client.sayHello(authzHeaderValue, name);
} else {
System.out.println("\n\n[JWT] No token :(\n\n");
return service.sayHello(null, name);
return client.sayHello(null, name);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.examples;

import jakarta.ws.rs.GET;
Expand All @@ -13,7 +17,7 @@
@RegisterClientHeaders
@RegisterRestClient(configKey="simple-microservice-server")
@Path("/hello")
public interface GettingStartedEndpointInterface {
public interface GettingStartedEndpointClient {
@GET
@Path("/{name}")
@Produces(MediaType.TEXT_PLAIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"credentials" : {
"secret" : "${env.OIDC_CLIENT_SECRET:KqIQIzNHD9LnCRjsCxblDnfEl4rcNoKB}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>
</web-app>
Loading

0 comments on commit d9fb804

Please sign in to comment.