kopia lustrzana https://github.com/gaul/s3proxy
Allow to use Azure managed identities for azureblob-sdk backend
rodzic
0ea6dbf438
commit
73df2b6f1a
|
@ -33,6 +33,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.azure.core.credential.AzureNamedKeyCredential;
|
import com.azure.core.credential.AzureNamedKeyCredential;
|
||||||
import com.azure.core.http.rest.PagedResponse;
|
import com.azure.core.http.rest.PagedResponse;
|
||||||
|
import com.azure.identity.DefaultAzureCredentialBuilder;
|
||||||
import com.azure.storage.blob.BlobServiceClient;
|
import com.azure.storage.blob.BlobServiceClient;
|
||||||
import com.azure.storage.blob.BlobServiceClientBuilder;
|
import com.azure.storage.blob.BlobServiceClientBuilder;
|
||||||
import com.azure.storage.blob.models.AccessTier;
|
import com.azure.storage.blob.models.AccessTier;
|
||||||
|
@ -123,9 +124,15 @@ public final class AzureBlobStore extends BaseBlobStore {
|
||||||
/*tryTimeoutInSeconds=*/ (Integer) null,
|
/*tryTimeoutInSeconds=*/ (Integer) null,
|
||||||
/*retryDelayInMs=*/ null, /*maxRetryDelayInMs=*/ null,
|
/*retryDelayInMs=*/ null, /*maxRetryDelayInMs=*/ null,
|
||||||
/*secondaryHost=*/ null);
|
/*secondaryHost=*/ null);
|
||||||
blobServiceClient = new BlobServiceClientBuilder()
|
var blobServiceClientBuilder = new BlobServiceClientBuilder();
|
||||||
.credential(new AzureNamedKeyCredential(
|
if (!cred.identity.isEmpty() && !cred.credential.isEmpty()) {
|
||||||
cred.identity, cred.credential))
|
blobServiceClientBuilder.credential(
|
||||||
|
new AzureNamedKeyCredential(cred.identity, cred.credential));
|
||||||
|
} else {
|
||||||
|
blobServiceClientBuilder.credential(
|
||||||
|
new DefaultAzureCredentialBuilder().build());
|
||||||
|
}
|
||||||
|
blobServiceClient = blobServiceClientBuilder
|
||||||
.endpoint(endpoint)
|
.endpoint(endpoint)
|
||||||
.retryOptions(retryOptions)
|
.retryOptions(retryOptions)
|
||||||
.buildClient();
|
.buildClient();
|
||||||
|
|
Ładowanie…
Reference in New Issue