This is an automated email from the ASF dual-hosted git repository. jiriondrusek pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 9072cc991ba0abfee3d3c8d99b9b1959563d62cd Author: JiriOndrusek <ondrusek.j...@gmail.com> AuthorDate: Mon May 6 17:03:25 2024 +0200 Fixed azure due to version update --- .../deployment/AzureCoreSupportProcessor.java | 14 ++++- extensions-support/azure-core/runtime/pom.xml | 5 -- ...AbstractClientApplicationBaseSubstitutions.java | 73 ---------------------- 3 files changed, 13 insertions(+), 79 deletions(-) diff --git a/extensions-support/azure-core/deployment/src/main/java/org/apache/camel/quarkus/support/reactor/netty/deployment/AzureCoreSupportProcessor.java b/extensions-support/azure-core/deployment/src/main/java/org/apache/camel/quarkus/support/reactor/netty/deployment/AzureCoreSupportProcessor.java index d85be77c0f..90c6cde3a1 100644 --- a/extensions-support/azure-core/deployment/src/main/java/org/apache/camel/quarkus/support/reactor/netty/deployment/AzureCoreSupportProcessor.java +++ b/extensions-support/azure-core/deployment/src/main/java/org/apache/camel/quarkus/support/reactor/netty/deployment/AzureCoreSupportProcessor.java @@ -18,11 +18,11 @@ package org.apache.camel.quarkus.support.reactor.netty.deployment; import java.io.IOException; import java.util.Set; +import java.util.function.BooleanSupplier; import java.util.stream.Stream; import com.azure.core.annotation.ServiceInterface; import com.azure.core.http.HttpClientProvider; -import com.microsoft.aad.msal4j.AbstractClientApplicationBaseSubstitutions.Msal4jIsPresent; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; @@ -110,4 +110,16 @@ public class AzureCoreSupportProcessor { runtimeReinitializedClass.produce(new RuntimeReinitializedClassBuildItem("com.sun.jna.platform.win32.Kernel32")); } } + + public static final class Msal4jIsPresent implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + try { + Thread.currentThread().getContextClassLoader().loadClass("com.microsoft.aad.msal4j.Credential"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } + } } diff --git a/extensions-support/azure-core/runtime/pom.xml b/extensions-support/azure-core/runtime/pom.xml index 058fa6b5b8..5c7727edd1 100644 --- a/extensions-support/azure-core/runtime/pom.xml +++ b/extensions-support/azure-core/runtime/pom.xml @@ -73,11 +73,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.graalvm.sdk</groupId> - <artifactId>nativeimage</artifactId> - <scope>provided</scope> - </dependency> </dependencies> <build> diff --git a/extensions-support/azure-core/runtime/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBaseSubstitutions.java b/extensions-support/azure-core/runtime/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBaseSubstitutions.java deleted file mode 100644 index c3ec5a3f50..0000000000 --- a/extensions-support/azure-core/runtime/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBaseSubstitutions.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.microsoft.aad.msal4j; - -import java.util.function.BooleanSupplier; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -@TargetClass(className = "com.microsoft.aad.msal4j.AbstractClientApplicationBase", onlyWith = AbstractClientApplicationBaseSubstitutions.Msal4jIsPresent.class) -public final class AbstractClientApplicationBaseSubstitutions { - - /** - * Cuts out instantiation of AcquireTokenByInteractiveFlowSupplier which leads to references of classes - * in package com.sun.net.httpserver. Since GraalVM 2.22.0, this package is not on the module path by default. - * - * An additional option is required for native-image in order to compile the application successfully - * -J--add-modules=jdk.httpserver. - * - * Given that interactive authentication is of little value in a production application (since in this case it requires - * the launching of a web browser and some human intervention to examine the resulting web page), it should be safe to - * disable AcquireTokenByInteractiveFlowSupplier. - */ - @Substitute - private AuthenticationResultSupplier getAuthenticationResultSupplier(MsalRequest msalRequest) { - AuthenticationResultSupplier supplier; - if (msalRequest instanceof DeviceCodeFlowRequest) { - supplier = new AcquireTokenByDeviceCodeFlowSupplier(PublicClientApplication.class.cast(this), - (DeviceCodeFlowRequest) msalRequest); - } else if (msalRequest instanceof SilentRequest) { - supplier = new AcquireTokenSilentSupplier(AbstractClientApplicationBase.class.cast(this), - (SilentRequest) msalRequest); - } else if (msalRequest instanceof InteractiveRequest) { - throw new IllegalArgumentException("InteractiveRequest is not supported on GraalVM"); - } else if (msalRequest instanceof ClientCredentialRequest) { - supplier = new AcquireTokenByClientCredentialSupplier(ConfidentialClientApplication.class.cast(this), - (ClientCredentialRequest) msalRequest); - } else if (msalRequest instanceof OnBehalfOfRequest) { - supplier = new AcquireTokenByOnBehalfOfSupplier(ConfidentialClientApplication.class.cast(this), - (OnBehalfOfRequest) msalRequest); - } else { - supplier = new AcquireTokenByAuthorizationGrantSupplier(AbstractClientApplicationBase.class.cast(this), msalRequest, - null); - } - return supplier; - } - - public static final class Msal4jIsPresent implements BooleanSupplier { - @Override - public boolean getAsBoolean() { - try { - Thread.currentThread().getContextClassLoader().loadClass("com.microsoft.aad.msal4j.Credential"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } - } -}