[ 
https://issues.apache.org/jira/browse/CAMEL-21280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sven updated CAMEL-21280:
-------------------------
    Description: 
In FilesOperations the client builder only handles the SHARED_ACCOUNT_KEY 
CredentialType, the others are misplaced under that if:

 
{code:java}
if 
(configuration.getCredentialType().equals(CredentialType.SHARED_ACCOUNT_KEY)) {
    if (sharedKey != null) {
        var keyB64 = FilesURIStrings.reconstructBase64EncodedValue(sharedKey);
        builder.credential(new 
StorageSharedKeyCredential(configuration.getAccount(), keyB64));
    } else if 
(configuration.getCredentialType().equals(CredentialType.AZURE_SAS)) {
        builder = builder.sasToken(token.toURIQuery());
    } else if 
(configuration.getCredentialType().equals(CredentialType.AZURE_IDENTITY)) {
        builder = builder.credential(new 
DefaultAzureCredentialBuilder().build());
    }
} {code}
Fix should be easy:
{code:java}
if (configuration.getCredentialType().equals(CredentialType.SHARED_ACCOUNT_KEY) 
&& sharedKey != null) {
    var keyB64 = FilesURIStrings.reconstructBase64EncodedValue(sharedKey);
    builder.credential(new 
StorageSharedKeyCredential(configuration.getAccount(), keyB64));
} else if (configuration.getCredentialType().equals(CredentialType.AZURE_SAS)) {
    builder = builder.sasToken(token.toURIQuery());
} else if 
(configuration.getCredentialType().equals(CredentialType.AZURE_IDENTITY)) {
    builder = builder.credential(new DefaultAzureCredentialBuilder().build());
} {code}

  was:
In FilesOperations the client builder only handles the SHARED_ACCOUNT_KEY 
CredentialType, the others are misplaced under that if:

 
{code:java}
if 
(configuration.getCredentialType().equals(CredentialType.SHARED_ACCOUNT_KEY)) {
    if (sharedKey != null) {
        var keyB64 = FilesURIStrings.reconstructBase64EncodedValue(sharedKey);
        builder.credential(new 
StorageSharedKeyCredential(configuration.getAccount(), keyB64));
    } else if 
(configuration.getCredentialType().equals(CredentialType.AZURE_SAS)) {
        builder = builder.sasToken(token.toURIQuery());
    } else if 
(configuration.getCredentialType().equals(CredentialType.AZURE_IDENTITY)) {
        builder = builder.credential(new 
DefaultAzureCredentialBuilder().build());
    }
} {code}


> azure-files: Only CredentialType.SHARED_ACCOUNT_KEY is handled
> --------------------------------------------------------------
>
>                 Key: CAMEL-21280
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21280
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-azure
>    Affects Versions: 4.7.0
>            Reporter: Sven
>            Priority: Major
>
> In FilesOperations the client builder only handles the SHARED_ACCOUNT_KEY 
> CredentialType, the others are misplaced under that if:
>  
> {code:java}
> if 
> (configuration.getCredentialType().equals(CredentialType.SHARED_ACCOUNT_KEY)) 
> {
>     if (sharedKey != null) {
>         var keyB64 = FilesURIStrings.reconstructBase64EncodedValue(sharedKey);
>         builder.credential(new 
> StorageSharedKeyCredential(configuration.getAccount(), keyB64));
>     } else if 
> (configuration.getCredentialType().equals(CredentialType.AZURE_SAS)) {
>         builder = builder.sasToken(token.toURIQuery());
>     } else if 
> (configuration.getCredentialType().equals(CredentialType.AZURE_IDENTITY)) {
>         builder = builder.credential(new 
> DefaultAzureCredentialBuilder().build());
>     }
> } {code}
> Fix should be easy:
> {code:java}
> if 
> (configuration.getCredentialType().equals(CredentialType.SHARED_ACCOUNT_KEY) 
> && sharedKey != null) {
>     var keyB64 = FilesURIStrings.reconstructBase64EncodedValue(sharedKey);
>     builder.credential(new 
> StorageSharedKeyCredential(configuration.getAccount(), keyB64));
> } else if 
> (configuration.getCredentialType().equals(CredentialType.AZURE_SAS)) {
>     builder = builder.sasToken(token.toURIQuery());
> } else if 
> (configuration.getCredentialType().equals(CredentialType.AZURE_IDENTITY)) {
>     builder = builder.credential(new DefaultAzureCredentialBuilder().build());
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to