Skip to content
Merged
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
11 changes: 11 additions & 0 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,17 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-proxy-registry</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-proxy-registry-deployment</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Quarkus extensions -->

<dependency>
Expand Down
13 changes: 13 additions & 0 deletions devtools/bom-descriptor-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2039,6 +2039,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-proxy-registry</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-quartz</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-proxy-registry-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-quartz-deployment</artifactId>
Expand Down
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<modules>
<module>virtual-threads</module>
<module>tls-registry</module>
<module>proxy-registry</module>

<!-- Plumbing -->
<module>arc</module>
Expand Down
55 changes: 55 additions & 0 deletions extensions/proxy-registry/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-proxy-registry-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-proxy-registry-deployment</artifactId>
<name>Quarkus - Proxy Registry - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-proxy-registry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-credentials-deployment</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.proxy.config.deployment;

import jakarta.inject.Singleton;

import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.proxy.config.ProxyConfig;
import io.quarkus.proxy.config.ProxyConfigurationRegistry;

public class ProxyConfigProcessor {

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void initializeProxyConfigurationRegistry(
ProxyConfigurationRegistry recorder,
ProxyConfig proxyConfig,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {

recorder.init(proxyConfig);
syntheticBeans.produce(SyntheticBeanBuildItem
.configure(ProxyConfigurationRegistry.class)
.supplier(recorder.getSupplier())
.scope(Singleton.class)
.unremovable()
.setRuntimeInit()
.done());

}
}
20 changes: 20 additions & 0 deletions extensions/proxy-registry/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-extensions-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-proxy-registry-parent</artifactId>
<name>Quarkus - Proxy Registry</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
</project>
55 changes: 55 additions & 0 deletions extensions/proxy-registry/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-proxy-registry-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-proxy-registry</artifactId>
<name>Quarkus - Proxy Registry - Runtime</name>
<description>Proxy Configuration used by other Quarkus extensions</description>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-credentials</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package io.quarkus.proxy.config;

import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.proxy.config.ProxyConfig.NamedProxyConfig;
import io.quarkus.runtime.annotations.ConfigDocDefault;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithParentName;

@ConfigMapping(prefix = "quarkus.proxy")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface ProxyConfig {

static final String NO_PROXY = "none";

@WithParentName
NamedProxyConfig defaultProxyConfig();

@WithParentName
Map<String, NamedProxyConfig> namedProxyConfigs();

@ConfigGroup
public interface NamedProxyConfig {

/**
* Proxy host.
*/
Optional<String> host();

/**
* Proxy port
*/
OptionalInt port();

/**
* The credential provider configuration for the proxy.
* A credential provider offers a way to retrieve the proxy password.
* Note that the credential provider is only used if the password is not set in the configuration.
*/
ProxyCredentialProviderConfig credentialsProvider();

/**
* Proxy username.
* <p>
* See also {@code credentials-provider}
*/
Optional<String> username();

/**
* Proxy password
* <p>
* See also {@code credentials-provider}
*/
Optional<String> password();

/**
* Hostnames or IP addresses to exclude from proxying
*/
Optional<List<String>> nonProxyHosts();

/**
* Proxy connection timeout.
*/
@ConfigDocDefault("10s")
Optional<Duration> proxyConnectTimeout();

/**
* The proxy type. Possible values are: {@code HTTP} (default), {@code SOCKS4} and {@code SOCKS5}.
*/
@WithDefault("http")
ProxyType type();

/**
* @return this {@link NamedProxyConfig} if {@link #type()} returns {@link ProxyType#HTTP}; otherwise throws an
* {@link IllegalStateException}
* @throws IllegalStateException if {@link #type()} does not return {@link ProxyType#HTTP}
*/
default NamedProxyConfig assertHttpType() {
if (type() != ProxyType.HTTP) {
throw new IllegalStateException("Proxy type HTTP is required");
}
return this;
}

static enum ProxyType {
HTTP,
SOCKS4,
SOCKS5;
}

}

@ConfigGroup
interface ProxyCredentialProviderConfig {

/**
* The name of the "credential" bucket (map key -> passwords) to retrieve from the
* {@link io.quarkus.credentials.CredentialsProvider}. If not set, the credential provider will not be used.
* <p>
* A credential provider offers a way to retrieve the key store password as well as alias password.
* Note that the credential provider is only used if the passwords are not set in the configuration.
*/
Optional<String> name();

/**
* The name of the bean providing the credential provider.
* <p>
* The name is used to select the credential provider to use.
* The credential provider must be exposed as a CDI bean and with the {@code @Named} annotation set to the
* configured name to be selected.
* <p>
* If not set, the default credential provider is used.
*/
Optional<String> beanName();

/**
* The key used to retrieve the username from the "credential" bucket.
* <p>
* If username, password or both cannot be retrieved from the credential provider, then a RuntimeException is thrown.
*/
@WithDefault(CredentialsProvider.USER_PROPERTY_NAME)
String usernameKey();

/**
* The key used to retrieve the password from the "credential" bucket.
* <p>
* If username, password or both cannot be retrieved from the credential provider, then a RuntimeException is thrown.
*/
@WithDefault(CredentialsProvider.PASSWORD_PROPERTY_NAME)
String passwordKey();

}
}
Loading
Loading