use of com.azure.core.credential.TokenCredential in project samza by apache.
the class AzureBlobClientBuilder method getBlobServiceAsyncClient.
/**
* method creates BlobServiceAsyncClient using the configs provided earlier.
* if the authentication method is set to {@link TokenCredential} then a {@link com.azure.identity.ClientSecretCredential}
* is created and used for the Blob client. Else authentication is done via account name and key using the
* {@link StorageSharedKeyCredential}.
* The config used to determine which authentication is systems.%s.azureblob.useTokenCredentialAuthentication = true
* for using TokenCredential.
* @return BlobServiceAsyncClient
*/
public BlobServiceAsyncClient getBlobServiceAsyncClient() {
BlobServiceClientBuilder blobServiceClientBuilder = getBlobServiceClientBuilder();
if (azureBlobConfig.getUseTokenCredentialAuthentication(systemName)) {
// Use your Azure Blob Storage account's name and client details to create a token credential object to access your account.
TokenCredential tokenCredential = getTokenCredential();
return blobServiceClientBuilder.credential(tokenCredential).buildAsyncClient();
}
// Use your Azure Blob Storage account's name and key to create a credential object to access your account.
StorageSharedKeyCredential storageSharedKeyCredential = getStorageSharedKeyCredential();
return blobServiceClientBuilder.credential(storageSharedKeyCredential).buildAsyncClient();
}
use of com.azure.core.credential.TokenCredential in project azure-iot-sdk-java by Azure.
the class Tools method buildDeviceMethodClientWithTokenCredential.
public static com.microsoft.azure.sdk.iot.service.devicetwin.DeviceMethod buildDeviceMethodClientWithTokenCredential() {
IotHubConnectionString iotHubConnectionStringObj = IotHubConnectionStringBuilder.createIotHubConnectionString(iotHubConnectionString);
TokenCredential tokenCredential = buildTokenCredentialFromEnvironment();
DeviceMethodClientOptions options = DeviceMethodClientOptions.builder().build();
return new com.microsoft.azure.sdk.iot.service.devicetwin.DeviceMethod(iotHubConnectionStringObj.getHostName(), tokenCredential, options);
}
use of com.azure.core.credential.TokenCredential in project azure-iot-sdk-java by Azure.
the class Tools method buildDigitalTwinClientWithTokenCredential.
public static DigitalTwinClient buildDigitalTwinClientWithTokenCredential() {
IotHubConnectionString iotHubConnectionStringObj = IotHubConnectionStringBuilder.createIotHubConnectionString(iotHubConnectionString);
TokenCredential tokenCredential = buildTokenCredentialFromEnvironment();
DigitalTwinClientOptions options = DigitalTwinClientOptions.builder().build();
return new DigitalTwinClient(iotHubConnectionStringObj.getHostName(), tokenCredential, options);
}
use of com.azure.core.credential.TokenCredential in project azure-iot-sdk-java by Azure.
the class Tools method buildDeviceTwinClientWithTokenCredential.
public static DeviceTwin buildDeviceTwinClientWithTokenCredential() {
IotHubConnectionString iotHubConnectionStringObj = IotHubConnectionStringBuilder.createIotHubConnectionString(iotHubConnectionString);
TokenCredential tokenCredential = buildTokenCredentialFromEnvironment();
DeviceTwinClientOptions options = DeviceTwinClientOptions.builder().build();
return new DeviceTwin(iotHubConnectionStringObj.getHostName(), tokenCredential, options);
}
use of com.azure.core.credential.TokenCredential in project azure-iot-sdk-java by Azure.
the class Tools method buildServiceClientWithTokenCredential.
public static ServiceClient buildServiceClientWithTokenCredential(IotHubServiceClientProtocol protocol) {
IotHubConnectionString iotHubConnectionStringObj = IotHubConnectionStringBuilder.createIotHubConnectionString(iotHubConnectionString);
TokenCredential tokenCredential = buildTokenCredentialFromEnvironment();
return new ServiceClient(iotHubConnectionStringObj.getHostName(), tokenCredential, protocol);
}
Aggregations