From d358312110ba7af1cc34fac523fc8a0361fdb4cc Mon Sep 17 00:00:00 2001 From: David Kocher Date: Tue, 16 Sep 2025 17:26:33 +0200 Subject: [PATCH 1/3] Add check for authentication method. --- .../java/ch/cyberduck/core/azure/AzureSession.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java b/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java index b6a4873aea9..34337f93b22 100644 --- a/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java +++ b/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java @@ -118,11 +118,13 @@ public void setCredentials(final Credentials credentials) { @Override public Mono process(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next) { if(credentials.isTokenAuthentication()) { - return new AzureSasCredentialPolicy(new AzureSasCredential( - credentials.getToken())).process(context, next); + return new AzureSasCredentialPolicy(new AzureSasCredential(credentials.getToken())).process(context, next); } - return new StorageSharedKeyCredentialPolicy(new StorageSharedKeyCredential( - credentials.getUsername(), credentials.getPassword())).process(context, next); + if(credentials.isPasswordAuthentication()) { + return new StorageSharedKeyCredentialPolicy(new StorageSharedKeyCredential( + credentials.getUsername(), credentials.getPassword())).process(context, next); + } + return next.process(); } } From 128e89f5ba0ba7ca4d1c9e6f679b3d7cb9bfe0e8 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Tue, 16 Sep 2025 17:30:14 +0200 Subject: [PATCH 2/3] Add dependency. --- azure/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure/pom.xml b/azure/pom.xml index ca2bfd888ef..37ad6e0ce54 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -31,6 +31,11 @@ core ${project.version} + + ch.cyberduck + oauth + ${project.version} + ch.cyberduck test From 37eb0e6e6011b2ea40bd5fbcc81bf0151dbaa194 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Tue, 16 Sep 2025 17:47:41 +0200 Subject: [PATCH 3/3] Delete unused. --- .../ch/cyberduck/core/azure/AzureSession.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java b/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java index 34337f93b22..efc9c2ff081 100644 --- a/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java +++ b/azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java @@ -89,7 +89,6 @@ protected BlobServiceClient connect(final ProxyFinder proxy, final HostKeyCallba .pipeline(new HttpPipelineBuilder() .httpClient(new ApacheHttpClient(pool)) .policies( - new EmptyAuthenticationPolicy(), new UserAgentPolicy(new PreferencesUseragentProvider().get()), new RequestIdPolicy(), new RequestRetryPolicy(new RequestRetryOptions()), @@ -201,20 +200,4 @@ public T _getFeature(final Class type) { } return super._getFeature(type); } - - private static final class EmptyAuthenticationPolicy extends BearerTokenAuthenticationPolicy { - public EmptyAuthenticationPolicy() { - super(request -> Mono.empty()); - } - - @Override - public HttpResponse processSync(final HttpPipelineCallContext context, final HttpPipelineNextSyncPolicy next) { - return next.processSync(); - } - - @Override - public Mono process(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next) { - return next.process(); - } - } }