Skip to content

Commit

Permalink
Files OAuth (#30127)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcc-msft authored Aug 10, 2022
1 parent 76d9a2c commit 20d3f39
Show file tree
Hide file tree
Showing 111 changed files with 20,489 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static BlobsClientBuilder GetNewBlobsClientBuilder(TenantConfigurationBui
(uri, clientOptions) => new BlobServiceClient(uri, clientOptions),
(uri, sharedKeyCredential, clientOptions) => new BlobServiceClient(uri, sharedKeyCredential, clientOptions),
(uri, tokenCredential, clientOptions) => new BlobServiceClient(uri, tokenCredential, clientOptions),
default,
(uri, azureSasCredential, clientOptions) => new BlobServiceClient(uri, azureSasCredential, clientOptions),
() => new BlobClientOptions(serviceVersion));

Expand Down
19 changes: 19 additions & 0 deletions sdk/storage/Azure.Storage.Common/tests/Shared/ClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public class ClientBuilder<TServiceClient, TServiceClientOptions>
/// </summary>
public delegate TServiceClient GetServiceClientTokenCredential(Uri endpoint, TokenCredential credential, TServiceClientOptions clientOptions);

/// <summary>
/// Delegate for accessing a token credential constructor with parameter for a service client.
/// </summary>
public delegate TServiceClient GetServiceClientTokenCredentialWithParameter(Uri endpoint, TokenCredential credential, object credentialParameter, TServiceClientOptions clientOptions);

/// <summary>
/// Delegate for accessing a credential-less constructor for a service client.
/// </summary>
Expand All @@ -55,6 +60,7 @@ public class ClientBuilder<TServiceClient, TServiceClientOptions>
private readonly GetServiceClientStorageSharedKeyCredential _getServiceClientStorageSharedKeyCredential;
private readonly GetServiceClientAzureSasCredential _getServiceClientAzureSasCredential;
private readonly GetServiceClientTokenCredential _getServiceClientTokenCredential;
private readonly GetServiceClientTokenCredentialWithParameter _getServiceClientTokenCredentialWithParameter;
private readonly GetServiceClient _getServiceClient;
private readonly GetServiceClientOptions _getServiceClientOptions;

Expand Down Expand Up @@ -88,6 +94,7 @@ public ClientBuilder(
GetServiceClient getServiceClient,
GetServiceClientStorageSharedKeyCredential getServiceClientStorageSharedKeyCredential,
GetServiceClientTokenCredential getServiceClientTokenCredential,
GetServiceClientTokenCredentialWithParameter getServiceClientTokenCredentialWithParameter,
GetServiceClientAzureSasCredential getServiceClientAzureSasCredential,
GetServiceClientOptions getServiceClientOptions)
{
Expand All @@ -96,6 +103,7 @@ public ClientBuilder(
_getServiceClient = getServiceClient;
_getServiceClientStorageSharedKeyCredential = getServiceClientStorageSharedKeyCredential;
_getServiceClientTokenCredential = getServiceClientTokenCredential;
_getServiceClientTokenCredentialWithParameter = getServiceClientTokenCredentialWithParameter;
_getServiceClientAzureSasCredential = getServiceClientAzureSasCredential;
_getServiceClientOptions = getServiceClientOptions;
}
Expand Down Expand Up @@ -144,6 +152,17 @@ public TServiceClient GetServiceClientFromOauthConfig(
Tenants.GetOAuthCredential(config),
options ?? GetOptions()));

public TServiceClient GetServiceClientFromOauthConfigWithParameter(
TenantConfiguration config,
TServiceClientOptions options = default,
object parameter = default)
=> AzureCoreRecordedTestBase.InstrumentClient(
_getServiceClientTokenCredentialWithParameter(
new Uri(GetEndpoint(config)),
Tenants.GetOAuthCredential(config),
parameter,
options ?? GetOptions()));

public TServiceClientOptions GetOptions(bool parallelRange = false)
{
var options = _getServiceClientOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static DataLakeClientBuilder GetNewDataLakeClientBuilder(TenantConfigurat
(uri, clientOptions) => new DataLakeServiceClient(uri, clientOptions),
(uri, sharedKeyCredential, clientOptions) => new DataLakeServiceClient(uri, sharedKeyCredential, clientOptions),
(uri, tokenCredential, clientOptions) => new DataLakeServiceClient(uri, tokenCredential, clientOptions),
default,
(uri, azureSasCredential, clientOptions) => new DataLakeServiceClient(uri, azureSasCredential, clientOptions),
() => new DataLakeClientOptions(serviceVersion));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ protected ShareClient() { }
public ShareClient(string connectionString, string shareName) { }
public ShareClient(string connectionString, string shareName, Azure.Storage.Files.Shares.ShareClientOptions options) { }
public ShareClient(System.Uri shareUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareClient(System.Uri shareUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareClient(System.Uri shareUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareClient(System.Uri shareUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public virtual string AccountName { get { throw null; } }
Expand Down Expand Up @@ -125,6 +126,7 @@ protected ShareDirectoryClient() { }
public ShareDirectoryClient(string connectionString, string shareName, string directoryPath) { }
public ShareDirectoryClient(string connectionString, string shareName, string directoryPath, Azure.Storage.Files.Shares.ShareClientOptions options) { }
public ShareDirectoryClient(System.Uri directoryUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareDirectoryClient(System.Uri directoryUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareDirectoryClient(System.Uri directoryUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareDirectoryClient(System.Uri directoryUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public virtual string AccountName { get { throw null; } }
Expand Down Expand Up @@ -191,6 +193,7 @@ protected ShareFileClient() { }
public ShareFileClient(string connectionString, string shareName, string filePath) { }
public ShareFileClient(string connectionString, string shareName, string filePath, Azure.Storage.Files.Shares.ShareClientOptions options) { }
public ShareFileClient(System.Uri fileUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareFileClient(System.Uri fileUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareFileClient(System.Uri fileUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareFileClient(System.Uri fileUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public virtual string AccountName { get { throw null; } }
Expand Down Expand Up @@ -335,6 +338,7 @@ protected ShareServiceClient() { }
public ShareServiceClient(string connectionString) { }
public ShareServiceClient(string connectionString, Azure.Storage.Files.Shares.ShareClientOptions options) { }
public ShareServiceClient(System.Uri serviceUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareServiceClient(System.Uri serviceUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareServiceClient(System.Uri serviceUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public ShareServiceClient(System.Uri serviceUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { }
public virtual string AccountName { get { throw null; } }
Expand Down Expand Up @@ -854,6 +858,11 @@ public ShareFileRequestConditions() { }
public string LeaseId { get { throw null; } set { } }
public override string ToString() { throw null; }
}
public enum ShareFileRequestIntent
{
None = 0,
Backup = 1,
}
[System.FlagsAttribute]
public enum ShareFileTraits
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 20d3f39

Please sign in to comment.