PART-13 || MTLS || Quarkus MTLS || Mutual Transport layer Security in Quarkus #quarkus
Client
--------------------------
@Path("/hello")
public class GreetingResource {
@Inject
@RestClient
GreetingService greetingService;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return greetingService.getMessage();
}
}
@ApplicationScoped
@RegisterRestClient
@Path("/helloserver")
public interface GreetingService {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getMessage();
}
application.properties
quarkus.http.ssl.client-auth=required
quarkus.http.ssl.certificate.trust-store-file=META-INF/resources/server.truststore
quarkus.http.ssl.certificate.trust-store-password=password
quarkus.rest-client."GreetingService".url=https://localhost:8443
quarkus.rest-client."GreetingService".trust-store=classpath:/META-INF/resources/client.truststore
quarkus.rest-client."GreetingService".trust-store-password=password
quarkus.rest-client."GreetingService".key-store=classpath:/META-INF/resources/client.keystore
quarkus.rest-client."GreetingService".key-store-password=password
Server
----------------
@Path("/helloserver")
public class GreetingResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello from SERVER";
}
}
application.properties
quarkus.http.port=0
quarkus.ssl.native=true
quarkus.http.ssl-port=8443
quarkus.http.ssl.certificate.key-store-file=META-INF/resources/server.keystore
quarkus.http.ssl.certificate.key-store-password=password