diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java index be458563030aa..4f311fa145343 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java @@ -171,8 +171,6 @@ public final class RunTimeConfigurationGenerator { static final MethodDescriptor CU_ADD_SOURCE_FACTORY_PROVIDER = MethodDescriptor.ofMethod(ConfigUtils.class, "addSourceFactoryProvider", void.class, SmallRyeConfigBuilder.class, ConfigSourceFactoryProvider.class); - static final MethodDescriptor CU_WITH_MAPPING = MethodDescriptor.ofMethod(ConfigUtils.class, "addMapping", - void.class, SmallRyeConfigBuilder.class, String.class, String.class); static final MethodDescriptor RCS_NEW = MethodDescriptor.ofConstructor(RuntimeConfigSource.class, String.class); static final MethodDescriptor RCSP_NEW = MethodDescriptor.ofConstructor(RuntimeConfigSourceProvider.class, String.class); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java index 2dd58393dc4d2..ffc3160264d0b 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java @@ -72,6 +72,7 @@ import io.quarkus.runtime.configuration.ConfigRecorder; import io.quarkus.runtime.configuration.DefaultsConfigSource; import io.quarkus.runtime.configuration.DisableableConfigSource; +import io.quarkus.runtime.configuration.MappingsConfigBuilder; import io.quarkus.runtime.configuration.QuarkusConfigValue; import io.quarkus.runtime.configuration.RuntimeOverrideConfigSource; import io.smallrye.config.ConfigMappings.ConfigClassWithPrefix; @@ -88,10 +89,6 @@ public class ConfigGenerationBuildStep { SmallRyeConfigBuilder.class, "withSources", SmallRyeConfigBuilder.class, ConfigSource[].class); - private static final MethodDescriptor WITH_MAPPING = MethodDescriptor.ofMethod( - SmallRyeConfigBuilder.class, "withMapping", - SmallRyeConfigBuilder.class, Class.class, String.class); - @BuildStep void staticInitSources( BuildProducer staticInitConfigSourceProviderBuildItem, @@ -513,15 +510,18 @@ private static void generateMappingsConfigBuilder( .classOutput(new GeneratedClassGizmoAdaptor(generatedClass, true)) .className(className) .interfaces(ConfigBuilder.class) + .superClass(MappingsConfigBuilder.class) .setFinal(true) .build()) { MethodCreator method = classCreator.getMethodCreator(CONFIG_BUILDER); ResultHandle configBuilder = method.getMethodParam(0); + MethodDescriptor addMapping = MethodDescriptor.ofMethod(MappingsConfigBuilder.class, "addMapping", void.class, + SmallRyeConfigBuilder.class, String.class, String.class); + for (ConfigClassWithPrefix mapping : mappings) { - method.invokeVirtualMethod(WITH_MAPPING, configBuilder, - method.loadClass(mapping.getKlass()), + method.invokeStaticMethod(addMapping, configBuilder, method.load(mapping.getKlass().getName()), method.load(mapping.getPrefix())); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java index 5c04a6a4f4199..afd9fadea3412 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java @@ -245,15 +245,6 @@ public static void addSourceFactoryProvider(SmallRyeConfigBuilder builder, Confi builder.withSources(provider.getConfigSourceFactory(Thread.currentThread().getContextClassLoader())); } - public static void addMapping(SmallRyeConfigBuilder builder, String mappingClass, String prefix) { - ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - try { - builder.withMapping(contextClassLoader.loadClass(mappingClass), prefix); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - } - public static List getProfiles() { return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getProfiles(); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/MappingsConfigBuilder.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/MappingsConfigBuilder.java new file mode 100644 index 0000000000000..24d1b607074be --- /dev/null +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/MappingsConfigBuilder.java @@ -0,0 +1,18 @@ +package io.quarkus.runtime.configuration; + +import io.smallrye.config.SmallRyeConfigBuilder; + +/** + * To support mappings that are not public + */ +public abstract class MappingsConfigBuilder implements ConfigBuilder { + protected static void addMapping(SmallRyeConfigBuilder builder, String mappingClass, String prefix) { + // TODO - Ideally should use the classloader passed to Config, but the method is not public. Requires a change in SmallRye Config. + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + try { + builder.withMapping(contextClassLoader.loadClass(mappingClass), prefix); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } +} diff --git a/docs/src/main/asciidoc/command-mode-reference.adoc b/docs/src/main/asciidoc/command-mode-reference.adoc index 73f2cbd46a499..a7810ef9767c1 100644 --- a/docs/src/main/asciidoc/command-mode-reference.adoc +++ b/docs/src/main/asciidoc/command-mode-reference.adoc @@ -54,7 +54,7 @@ import io.quarkus.runtime.annotations.QuarkusMain; public class HelloWorldMain implements QuarkusApplication { @Override public int run(String... args) throws Exception { // <.> - System.out.println("Hello " + args[1]); + System.out.println("Hello " + args[0]); return 0; } } diff --git a/docs/src/main/asciidoc/config-extending-support.adoc b/docs/src/main/asciidoc/config-extending-support.adoc index fa4c16f5c7dc2..53c51f991ad22 100644 --- a/docs/src/main/asciidoc/config-extending-support.adoc +++ b/docs/src/main/asciidoc/config-extending-support.adoc @@ -368,6 +368,8 @@ The `ConfigSourceInterceptorFactory` may initialize an interceptor with access t ---- package org.acme.config; +import static io.smallrye.config.SecretKeys.doLocked; + import javax.annotation.Priority; import io.smallrye.config.ConfigSourceInterceptor; diff --git a/docs/src/main/asciidoc/doc-reference.adoc b/docs/src/main/asciidoc/doc-reference.adoc index d71bf0fd59972..f45d1423b05d6 100644 --- a/docs/src/main/asciidoc/doc-reference.adoc +++ b/docs/src/main/asciidoc/doc-reference.adoc @@ -56,7 +56,7 @@ Your titles and headings must also follow the specific guidance for the Quarkus .Title guidance for different Quarkus content types [cols="15%,25%a,30%,30%"] |=== -|Content type |Should ... |Good example|Bad example +|Content type |Should ... |Good example |Bad example |Concept |* Start with a noun that names the concept or topic diff --git a/docs/src/main/asciidoc/jreleaser.adoc b/docs/src/main/asciidoc/jreleaser.adoc index d7b54cc7a3378..6e57bd1576c76 100644 --- a/docs/src/main/asciidoc/jreleaser.adoc +++ b/docs/src/main/asciidoc/jreleaser.adoc @@ -6,7 +6,7 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc = Packaging And Releasing With JReleaser include::_attributes.adoc[] -:jreleaser-version: 0.9.1 +:jreleaser-version: 1.6.0 :numbered: :sectnums: @@ -121,7 +121,7 @@ to the `` section of the file: kr.motd.maven os-maven-plugin - 1.7.0 + 1.7.1 @@ -337,7 +337,7 @@ configuration section, like so: - NATIVE_IMAGE + BINARY ${distribution.directory}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz @@ -367,8 +367,8 @@ that there's a configured distribution the plugin expects more metadata to be pr [source] ---- -[WARNING] [validation] project.copyright must not be blank since 0.4.0. This warning will become an error in a future release. [ERROR] == JReleaser == +[ERROR] project.copyright must not be blank [ERROR] project.description must not be blank [ERROR] project.website must not be blank [ERROR] project.docsUrl must not be blank @@ -384,9 +384,11 @@ POM elements. If you choose the former option then the plugin's configuration ma - app -- Sample Quarkus CLI application - pass:[https://github.com/aalmiray/app] - pass:[https://github.com/aalmiray/app] + app - Sample Quarkus CLI application + + https://github.com/aalmiray/app + https://github.com/aalmiray/app + APACHE-2.0 Andres Almiray 2021 Kordamp @@ -451,7 +453,7 @@ For this to work we simply have to enable Homebrew in the JReleaser plugin confi ---- - NATIVE_IMAGE + BINARY ALWAYS @@ -489,28 +491,37 @@ remote resources such as Git repositories. This is how it would look like: ---- # because we changed the project's version ./mvnw -Pnative,dist package -./mvnw -Prelease jreleaser:full-release -Djreleaser.select.current.platform -Djreleaser.dryrun +./mvnw -Prelease jreleaser:full-release -Djreleaser.select.current.platform -Djreleaser.dry.run=true [INFO] --- jreleaser-maven-plugin:{jreleaser-version}:full-release (default-cli) @ app --- [INFO] JReleaser {jreleaser-version} [INFO] - basedir set to /tmp/app +[INFO] - outputdir set to /tmp/app/target/jreleaser [WARNING] Platform selection is in effect [WARNING] Artifacts will be filtered by platform matching: [osx-x86_64] +[INFO] git-root-search set to false [INFO] Loading variables from /Users/aalmiray/.jreleaser/config.toml [INFO] Validating configuration +[INFO] Strict mode set to false [INFO] Project version set to 1.0.0.Alpha1 [INFO] Release is not snapshot -[INFO] Timestamp is 2021-12-16T13:31:12.163687+01:00 -[INFO] HEAD is at a21f3f2 +[INFO] Timestamp is 2023-04-27T15:06:34.289907+02:00 +[INFO] HEAD is at 73603ac [INFO] Platform is osx-x86_64 -[INFO] dryrun set to true -[INFO] Generating changelog: target/jreleaser/release/CHANGELOG.md -[INFO] Calculating checksums +[INFO] dry-run set to true +[INFO] Generating changelog +[INFO] Storing changelog: target/jreleaser/release/CHANGELOG.md +[INFO] Cataloging artifacts +[INFO] [sbom] Cataloging is not enabled. Skipping +[INFO] Calculating checksums for distributions and files [INFO] [checksum] target/distributions/app-1.0.0.Alpha1-osx-x86_64.zip.sha256 -[INFO] Signing files -[INFO] Signing is not enabled. Skipping -[INFO] Uploading is not enabled. Skipping -[INFO] Releasing to https://github.com/aalmiray/app +[INFO] Signing distributions and files +[INFO] [sign] Signing is not enabled. Skipping +[INFO] Deploying Maven artifacts +[INFO] [maven] Deploying is not enabled. Skipping +[INFO] Uploading distributions and files +[INFO] [upload] Uploading is not enabled. Skipping +[INFO] Releasing to https://github.com/aalmiray/app@main [INFO] - uploading app-1.0.0.Alpha1-osx-x86_64.zip [INFO] - uploading checksums_sha256.txt [INFO] Preparing distributions @@ -524,9 +535,10 @@ remote resources such as Git repositories. This is how it would look like: [INFO] [brew] publishing app distribution [INFO] [brew] setting up repository aalmiray/homebrew-tap [INFO] Announcing release -[INFO] Announcing is not enabled. Skipping +[INFO] [announce] Announcing is not enabled. Skipping [INFO] Writing output properties to target/jreleaser/output.properties -[INFO] JReleaser succeeded after 1.335 s +[INFO] JReleaser succeeded after 0.620 s + ---- JReleaser will perform the following tasks for us: @@ -539,25 +551,26 @@ JReleaser will perform the following tasks for us: * Upload all assets, including checksums. * Create a Homebrew formula, publishing to pass:[https://github.com/aalmiray/homebrew-tap]. -Of course no remote repository was affected as we can appreciate the `-Djreleaser.dryrun` property was in effect. If you're +Of course no remote repository was affected as we can appreciate the `-Djreleaser.dry.run=true` property was in effect. If you're so inclined inspect the contents of `target/jreleaser/package/app/brew/Formula/app.rb` which defines the Homebrew formula to be published. It should look something like this: -[source,ruby,subs=macros+] +[source,ruby,subs=attributes,macros+] .app.rb ---- +# Generated with JReleaser {jreleaser-version} at 2023-04-27T15:06:34.289907+02:00 class App < Formula desc "app -- Sample Quarkus CLI application" homepage "pass:[https://github.com/aalmiray/app]" url "pass:[https://github.com/aalmiray/app/releases/download/v1.0.0.Alpha1/app-1.0.0.Alpha1-osx-x86_64.zip]" version "1.0.0.Alpha1" - sha256 "a7e8df6eef3c4c5df7357e678b3c4bc6945b926cec4178a0239660de5dba0fc4" + sha256 "85c9918b23e3ac4ef64d5dd02714e241231d3f1358afdba09d3fd0b9a889e131" license "Apache-2.0" def install libexec.install Dir["*"] - bin.install_symlink "#{libexec}/bin/app" + bin.install_symlink "#{libexec}/bin/app" => "app" end test do @@ -567,7 +580,7 @@ class App < Formula end ---- -When ready, create a release for real this time by simply removing the `-Djreleaser.dryrun` flag from the command line, then +When ready, create a release for real this time by simply removing the `-Djreleaser.dry.run` flag from the command line, then browse to your repository and look at the freshly created release. == Further reading @@ -649,7 +662,7 @@ As a reference, these are the full contents of the `pom.xml`: kr.motd.maven os-maven-plugin - 1.7.0 + 1.7.1 @@ -695,30 +708,8 @@ As a reference, these are the full contents of the `pom.xml`: native - - - - maven-failsafe-plugin - ${surefire-plugin.version} - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - org.jboss.logmanager.LogManager - ${maven.home} - - - - - - - + false native @@ -792,7 +783,7 @@ As a reference, these are the full contents of the `pom.xml`: - NATIVE_IMAGE + BINARY ALWAYS diff --git a/docs/src/main/asciidoc/redis-reference.adoc b/docs/src/main/asciidoc/redis-reference.adoc index 4afba3b3e2c64..5d659a26f4114 100644 --- a/docs/src/main/asciidoc/redis-reference.adoc +++ b/docs/src/main/asciidoc/redis-reference.adoc @@ -727,7 +727,7 @@ This behavior is disabled in _prod_ mode, and if you want to import even in prod %prod.quarkus.redis.load-script=import.redis ---- -Before importing in _prod_ mode, mae sure you configured `quarkus.redis.flush-before-load` accordingly. +Before importing in _prod_ mode, make sure you configured `quarkus.redis.flush-before-load` accordingly. IMPORTANT: In dev mode, to reload the content of the `.redis` load scripts, you need to add: `%dev.quarkus.vertx.caching=false` diff --git a/docs/src/main/asciidoc/security-openid-connect-client-reference.adoc b/docs/src/main/asciidoc/security-openid-connect-client-reference.adoc index 1d648704ed2a1..befc5b6ec4016 100644 --- a/docs/src/main/asciidoc/security-openid-connect-client-reference.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-client-reference.adoc @@ -721,8 +721,8 @@ quarkus.oidc.client.tls.key-store-password=${key-store-password} #quarkus.oidc.client.tls.key-store-alias-password=keyAliasPassword # Truststore configuration -quarkus.oidc.client.tls.trust-store-file=client-truststore.jks -quarkus.oidc.client.tls.trust-store-password=${trust-store-password} +quarkus.oidc-client.tls.trust-store-file=client-truststore.jks +quarkus.oidc-client.tls.trust-store-password=${trust-store-password} # Add more truststore properties if needed: #quarkus.oidc.client.tls.trust-store-alias=certAlias ---- diff --git a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc index ebbe7f579c0e3..b5cd1c8ddc8ca 100644 --- a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc @@ -208,7 +208,7 @@ quarkus.http.auth.permission.authenticated.paths=/* quarkus.http.auth.permission.authenticated.policy=authenticated ---- -The first configuration is the default tenant configuration that should be used when the tenant can not be inferred from the request. Note that a `%prod` prodile prefix is used with `quarkus.oidc.auth-server-url` - it is done to support testing a multi-tenant application with `Dev Services For Keycloak`. This configuration is using a Keycloak instance to authenticate users. +The first configuration is the default tenant configuration that should be used when the tenant can not be inferred from the request. Note that a `%prod` profile prefix is used with `quarkus.oidc.auth-server-url` - it is done to support testing a multi-tenant application with `Dev Services For Keycloak`. This configuration is using a Keycloak instance to authenticate users. The second configuration is provided by `TenantConfigResolver`, it is the configuration that will be used when an incoming request is mapped to the tenant `tenant-a`. diff --git a/extensions/container-image/container-image-docker/deployment/src/test/java/io/quarkus/container/image/docker/deployment/RedHatOpenJDKRuntimeBaseProviderTest.java b/extensions/container-image/container-image-docker/deployment/src/test/java/io/quarkus/container/image/docker/deployment/RedHatOpenJDKRuntimeBaseProviderTest.java index 489beb17221cb..b7b1f61120dfd 100644 --- a/extensions/container-image/container-image-docker/deployment/src/test/java/io/quarkus/container/image/docker/deployment/RedHatOpenJDKRuntimeBaseProviderTest.java +++ b/extensions/container-image/container-image-docker/deployment/src/test/java/io/quarkus/container/image/docker/deployment/RedHatOpenJDKRuntimeBaseProviderTest.java @@ -16,7 +16,7 @@ void testImageWithJava11() { Path path = getPath("openjdk-11-runtime"); var result = sut.determine(path); assertThat(result).hasValueSatisfying(v -> { - assertThat(v.getBaseImage()).isEqualTo("registry.access.redhat.com/ubi8/openjdk-11-runtime:1.14"); + assertThat(v.getBaseImage()).isEqualTo("registry.access.redhat.com/ubi8/openjdk-11-runtime:1.15"); assertThat(v.getJavaVersion()).isEqualTo(11); }); } @@ -26,7 +26,7 @@ void testImageWithJava17() { Path path = getPath("openjdk-17-runtime"); var result = sut.determine(path); assertThat(result).hasValueSatisfying(v -> { - assertThat(v.getBaseImage()).isEqualTo("registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14"); + assertThat(v.getBaseImage()).isEqualTo("registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15"); assertThat(v.getJavaVersion()).isEqualTo(17); }); } diff --git a/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-11-runtime b/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-11-runtime index 0cbac0dfb5547..242b681bff897 100644 --- a/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-11-runtime +++ b/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-11-runtime @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:1.14 +FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:1.15 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' diff --git a/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-17-runtime b/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-17-runtime index 1238ab8318d4a..ae53314ed64b5 100644 --- a/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-17-runtime +++ b/extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-17-runtime @@ -1,5 +1,5 @@ # Use Java 17 base image -FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14 +FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java index c7ce9311e43e8..613bf360428ec 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java @@ -16,9 +16,9 @@ public class JibConfig { /** * The base image to be used when a container image is being produced for the jar build. * - * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14} + * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15} * is used as the default. - * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11-runtime:1.14} is used as the default. + * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11-runtime:1.15} is used as the default. */ @ConfigItem public Optional baseJvmImage; diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java index 56f40099ae870..4d4b573ee218f 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java @@ -89,8 +89,8 @@ public class JibProcessor { private static final IsClassPredicate IS_CLASS_PREDICATE = new IsClassPredicate(); private static final String BINARY_NAME_IN_CONTAINER = "application"; - private static final String JAVA_17_BASE_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14"; - private static final String JAVA_11_BASE_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11-runtime:1.14"; + private static final String JAVA_17_BASE_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15"; + private static final String JAVA_11_BASE_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11-runtime:1.15"; private static final String DEFAULT_BASE_IMAGE_USER = "185"; private static final String OPENTELEMETRY_CONTEXT_CONTEXT_STORAGE_PROVIDER_SYS_PROP = "io.opentelemetry.context.contextStorageProvider"; diff --git a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftConfig.java b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftConfig.java index 9edc611f2ab89..52be274270d0d 100644 --- a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftConfig.java +++ b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/OpenshiftConfig.java @@ -13,8 +13,8 @@ @ConfigRoot(phase = ConfigPhase.BUILD_TIME) public class OpenshiftConfig { - public static final String DEFAULT_BASE_JVM_JDK11_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11:1.14"; - public static final String DEFAULT_BASE_JVM_JDK17_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17:1.14"; + public static final String DEFAULT_BASE_JVM_JDK11_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11:1.15"; + public static final String DEFAULT_BASE_JVM_JDK17_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17:1.15"; public static final String DEFAULT_BASE_NATIVE_IMAGE = "quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0"; public static final String DEFAULT_NATIVE_TARGET_FILENAME = "application"; @@ -42,9 +42,9 @@ public static String getDefaultJvmImage(CompiledJavaVersionBuildItem.JavaVersion /** * The base image to be used when a container image is being produced for the jar build. * - * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17:1.14} + * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17:1.15} * is used as the default. - * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11:1.14} is used as the default. + * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11:1.15} is used as the default. */ @ConfigItem public Optional baseJvmImage; diff --git a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/S2iConfig.java b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/S2iConfig.java index b01459912145c..098725815e833 100644 --- a/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/S2iConfig.java +++ b/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/S2iConfig.java @@ -12,8 +12,8 @@ @ConfigRoot(phase = ConfigPhase.BUILD_TIME) public class S2iConfig { - public static final String DEFAULT_BASE_JVM_JDK11_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11:1.14"; - public static final String DEFAULT_BASE_JVM_JDK17_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17:1.14"; + public static final String DEFAULT_BASE_JVM_JDK11_IMAGE = "registry.access.redhat.com/ubi8/openjdk-11:1.15"; + public static final String DEFAULT_BASE_JVM_JDK17_IMAGE = "registry.access.redhat.com/ubi8/openjdk-17:1.15"; public static final String DEFAULT_BASE_NATIVE_IMAGE = "quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0"; public static final String DEFAULT_NATIVE_TARGET_FILENAME = "application"; @@ -41,9 +41,9 @@ public static String getDefaultJvmImage(CompiledJavaVersionBuildItem.JavaVersion /** * The base image to be used when a container image is being produced for the jar build. * - * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17:1.14} + * When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17:1.15} * is used as the default. - * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11:1.14} is used as the default. + * Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11:1.15} is used as the default. */ @ConfigItem public Optional baseJvmImage; diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/AbstractJsonObjectResponse.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/AbstractJsonObjectResponse.java index 070a39b683fe5..94a5ff6ca3622 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/AbstractJsonObjectResponse.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/AbstractJsonObjectResponse.java @@ -29,11 +29,11 @@ public AbstractJsonObjectResponse(JsonObject json) { } public String getString(String name) { - return json.getString(name); + return contains(name) ? json.getString(name) : null; } public Boolean getBoolean(String name) { - return json.getBoolean(name); + return contains(name) ? json.getBoolean(name) : null; } public Long getLong(String name) { diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java index f35e423cba83b..89f302a67cb9f 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java @@ -296,7 +296,7 @@ private static Key readTokenDecryptionKey(OidcTenantConfig oidcConfig) { List keys = KeyUtils.loadJsonWebKeys(keyContent); if (keys != null && keys.size() == 1 && (keys.get(0).getAlgorithm() == null - || keys.get(0).getAlgorithm() == KeyEncryptionAlgorithm.RSA_OAEP.getAlgorithm()) + || keys.get(0).getAlgorithm().equals(KeyEncryptionAlgorithm.RSA_OAEP.getAlgorithm())) && ("enc".equals(keys.get(0).getUse()) || keys.get(0).getUse() == null)) { key = PublicJsonWebKey.class.cast(keys.get(0)).getPrivateKey(); } diff --git a/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/UserInfoTest.java b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/UserInfoTest.java new file mode 100644 index 0000000000000..83d4f6ffba34f --- /dev/null +++ b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/UserInfoTest.java @@ -0,0 +1,29 @@ +package io.quarkus.oidc.runtime; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +import io.quarkus.oidc.UserInfo; + +public class UserInfoTest { + UserInfo userInfo = new UserInfo( + "{" + + "\"name\": \"alice\"," + + "\"admin\": true" + + "}"); + + @Test + public void testGetString() { + assertEquals("alice", userInfo.getString("name")); + assertNull(userInfo.getString("names")); + } + + @Test + public void testGetBoolean() { + assertTrue(userInfo.getBoolean("admin")); + assertNull(userInfo.getBoolean("admins")); + } +} diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java index 0cab46d8b25c3..d3772143e0d8e 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java @@ -153,7 +153,11 @@ private LocalProject loadAndCacheProject(Path pomFile) throws BootstrapMavenExce } private Model rawModel(Path pomFile) throws BootstrapMavenException { - final Path moduleDir = pomFile.getParent(); + var moduleDir = pomFile.getParent(); + if (moduleDir != null) { + // the path might not be normalized, while the modelProvider below would typically recognize normalized absolute paths + moduleDir = moduleDir.normalize().toAbsolutePath(); + } Model rawModel = rawModelCache.get(moduleDir); if (rawModel != null) { return rawModel; diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute index 342f6f80fa105..4f171e6d7a026 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute @@ -75,7 +75,7 @@ # accessed directly. (example: "foo.example.com,bar.example.com") # ### -FROM registry.access.redhat.com/ubi8/openjdk-{java.version}:1.14 +FROM registry.access.redhat.com/ubi8/openjdk-{java.version}:1.15 ENV LANGUAGE='en_US:en' diff --git a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java index b0a167d704e74..5a0436c96b36a 100644 --- a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java +++ b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java @@ -297,13 +297,13 @@ private void checkDockerfilesWithMaven(Path projectDir) { assertThat(projectDir.resolve("src/main/docker/Dockerfile.jvm")).exists() .satisfies(checkContains("./mvnw package")) .satisfies(checkContains("docker build -f src/main/docker/Dockerfile.jvm")) - .satisfies(checkContains("registry.access.redhat.com/ubi8/openjdk-11:1.14"))//TODO: make a teste to java17 + .satisfies(checkContains("registry.access.redhat.com/ubi8/openjdk-11:1.15"))//TODO: make a test for java17 .satisfies(checkContains("ENV JAVA_APP_JAR=\"/deployments/quarkus-run.jar\"")) .satisfies(checkNotContains("ENTRYPOINT")); assertThat(projectDir.resolve("src/main/docker/Dockerfile.legacy-jar")).exists() .satisfies(checkContains("./mvnw package -Dquarkus.package.type=legacy-jar")) .satisfies(checkContains("docker build -f src/main/docker/Dockerfile.legacy-jar")) - .satisfies(checkContains("registry.access.redhat.com/ubi8/openjdk-11:1.14")) + .satisfies(checkContains("registry.access.redhat.com/ubi8/openjdk-11:1.15")) .satisfies(checkContains("EXPOSE 8080")) .satisfies(checkContains("USER 185")) .satisfies(checkContains("ENV JAVA_APP_JAR=\"/deployments/quarkus-run.jar\"")) diff --git a/integration-tests/oidc-wiremock/src/main/resources/application.properties b/integration-tests/oidc-wiremock/src/main/resources/application.properties index cd675540342b3..850b5c15dc890 100644 --- a/integration-tests/oidc-wiremock/src/main/resources/application.properties +++ b/integration-tests/oidc-wiremock/src/main/resources/application.properties @@ -25,7 +25,7 @@ quarkus.oidc.code-flow-encrypted-id-token-jwk.client-id=quarkus-web-app quarkus.oidc.code-flow-encrypted-id-token-jwk.credentials.secret=secret quarkus.oidc.code-flow-encrypted-id-token-jwk.application-type=web-app quarkus.oidc.code-flow-encrypted-id-token-jwk.token-path=${keycloak.url}/realms/quarkus/encrypted-id-token -quarkus.oidc.code-flow-encrypted-id-token-jwk.token.decryption-key-location=privateKey.jwk +quarkus.oidc.code-flow-encrypted-id-token-jwk.token.decryption-key-location=privateKeyEncryptedIdToken.jwk quarkus.oidc.code-flow-encrypted-id-token-pem.auth-server-url=${keycloak.url}/realms/quarkus/ quarkus.oidc.code-flow-encrypted-id-token-pem.client-id=quarkus-web-app diff --git a/integration-tests/oidc-wiremock/src/main/resources/privateKeyEncryptedIdToken.jwk b/integration-tests/oidc-wiremock/src/main/resources/privateKeyEncryptedIdToken.jwk new file mode 100644 index 0000000000000..5f0a577eff87b --- /dev/null +++ b/integration-tests/oidc-wiremock/src/main/resources/privateKeyEncryptedIdToken.jwk @@ -0,0 +1,14 @@ +{ + "kty":"RSA", +"alg":"RSA-OAEP", +"use":"enc", + "kid":"1", + "n":"iJw33l1eVAsGoRlSyo-FCimeOc-AaZbzQ2iESA3Nkuo3TFb1zIkmt0kzlnWVGt48dkaIl13Vdefh9hqw_r9yNF8xZqX1fp0PnCWc5M_TX_ht5fm9y0TpbiVmsjeRMWZn4jr3DsFouxQ9aBXUJiu26V0vd2vrECeeAreFT4mtoHY13D2WVeJvboc5mEJcp50JNhxRCJ5UkY8jR_wfUk2Tzz4-fAj5xQaBccXnqJMu_1C6MjoCEiB7G1d13bVPReIeAGRKVJIF6ogoCN8JbrOhc_48lT4uyjbgnd24beatuKWodmWYhactFobRGYo5551cgMe8BoxpVQ4to30cGA0qjQ", + "e":"AQAB", + "d":"AvIDTlsK_priQLTwEQf5IVf2Xl638Q7dHdXyDC-oAAPmv1GcqRVH7Wm5oAPW_CZQfWhV55WRVaJzP8AhksyD5NcslH79hQZT4NT6xgApGYecrvmseuZ4dfR-e1cxXTRNBxaoXvwSiv4LuOPHmC8XGX712AhOoCGKiZp1WFqqkKwTpkgJEApJFVb-XRIKQa0YaRKpJsJ534pLMwTh7LoPLM4BCaBVbRfHzH2H5L3TSJP718kyCuxg3z2p9Y7zIOLTmgFdeR0_kd_xKUFZ2ByN3SKlC0IWlLUSiMPsGYExRpZTMZHKyD939gv-2_Z-bOYfKlYNIvAmQH_8CcX2I039LQ", + "p":"104AjPaxZoi_BiMBODlChnZOvRJT071PdkeZ283uyrdW8qqKD9q8FTMgUXzKoboHtUiHbJbLOobPmPDh93839rq7dTdCNzNVOuLmE-V3_bmaShdzvxEIazwPf6AvjbEZAc-zu2RS4SNkp1LbzgSl9nINSlF7t6Lkl6T28PYULys", + "q":"om5ooyzxa4ZJ-dU0ODsEb-Bmz6xwb27xF9aEhBYJprHeoNs2QM1D64_A39weD9MYwBux4-ivshCJ0dVKEbDujJRLnzf-ssrasA6CFyaaCT4DKtq1oWb9rcG-2LQd5Bm9PttrUrSUNqitr085IYikaLEz7UU6gtXPoC8UOcJ4cSc", + "dp":"DeWE95Q8oweUfMrpmz1m49LjBiUWsAX6CQJaFevWy9LFk-gZ_Sf7F8sy_M93LLUbJkJGK2YYO_DTmWWC0Dyv2gb3bntglLuFdsWKYCJhekjugnW9DMoGpxU7Utt99kFGAe3sBd5V0x47sukQMt3t8FgwL2nO-G1VH8yP-8GGT_0", + "dq":"TGBeE1wuqMCcSD1YMJiPnYuGzF_o_nzMIMldxj4Wi6tXY4uwFwhtx3Xw21JFUGuSV8KuAtyGwNPF-kSwb2Eiyjdw140c1jVMXzxzLy-XfoEKPDxa62niHrHba0pGQ9tWgRfrfxgqGQl3odc-peX6aL_qCsdim-KtnkSE3iPzPkE", + "qi":"Jzp5KnT24y0wOoPUn_11S3ZcYl0i03dkaH4c5zR02G1MJG9K017juurx2aXVTctOzrj7O226EUiL1Qbq3QtnWFDDGY6vNZuqzJM7AMXsvp1djq_6fEVhxCIOgfJbmhb3mkG82rxn4et9o_TNr6mvEmHzG15sHbvZbAnn4GeqToY" +}