Skip to content

Commit 27fd311

Browse files
committed
Continue refactoring
1 parent 0e18eb8 commit 27fd311

File tree

3 files changed

+11
-48
lines changed

3 files changed

+11
-48
lines changed

tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultConfiguration.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultSecretsProvider.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ public async Task<X509Certificate2> GetCertificateWithPrivateMaterialAsync(strin
8686

8787
private async Task<TokenCredential> GetKeyVaultCredentialAsync()
8888
{
89-
var accessToken = await LabAuthenticationHelper.GetLabAccessTokenAsync(
90-
"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/",
91-
new[] { "https://vault.azure.net/.default" }).ConfigureAwait(false);
89+
var accessToken = await LabAuthenticationHelper.GetKeyVaultAccessToken().ConfigureAwait(false);
9290
return DelegatedTokenCredential.Create((_, __) => accessToken);
9391
}
9492

tests/Microsoft.Identity.Test.LabInfrastructure/LabAuthenticationHelper.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ public static async Task<AccessToken> GetAccessTokenForLabAPIAsync()
2525
scopes).ConfigureAwait(false);
2626
}
2727

28-
public static async Task<AccessToken> GetLabAccessTokenAsync(string authority, string[] scopes)
28+
public static async Task<AccessToken> GetKeyVaultAccessToken()
29+
{
30+
var accessToken = await GetLabAccessTokenAsync(
31+
"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/",
32+
new[] { "https://vault.azure.net/.default" }).ConfigureAwait(false);
33+
34+
return accessToken;
35+
}
36+
37+
private static async Task<AccessToken> GetLabAccessTokenAsync(string authority, string[] scopes)
2938
{
3039
AuthenticationResult authResult;
3140
IConfidentialClientApplication confidentialApp;
@@ -55,10 +64,4 @@ public static async Task<AccessToken> GetLabAccessTokenAsync(string authority, s
5564
}
5665
}
5766

58-
public enum LabAccessAuthenticationType
59-
{
60-
ClientCertificate,
61-
ClientSecret,
62-
UserCredential
63-
}
6467
}

0 commit comments

Comments
 (0)