Skip to content
Draft
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
5 changes: 5 additions & 0 deletions azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.cyberduck</groupId>
<artifactId>oauth</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.cyberduck</groupId>
<artifactId>test</artifactId>
Expand Down
27 changes: 6 additions & 21 deletions azure/src/main/java/ch/cyberduck/core/azure/AzureSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -118,11 +117,13 @@ public void setCredentials(final Credentials credentials) {
@Override
public Mono<HttpResponse> 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();
}
}

Expand Down Expand Up @@ -199,20 +200,4 @@ public <T> T _getFeature(final Class<T> 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<HttpResponse> process(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next) {
return next.process();
}
}
}
Loading