diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/CertificateHelper.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/CertificateHelper.cs index 1a2b3e2e43..ed59fc08d6 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/CertificateHelper.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/CertificateHelper.cs @@ -36,7 +36,7 @@ public static X509Certificate2 FindCertificateByName(string subjectName) /// in which to search for a matching certificate /// in which to search for a matching certificate /// with , or null if no matching certificate was found - public static X509Certificate2 FindCertificateByName(string certName, StoreLocation location, StoreName name) + private static X509Certificate2 FindCertificateByName(string certName, StoreLocation location, StoreName name) { // Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores if (SharedUtilities.IsLinuxPlatform()) diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultConfiguration.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultConfiguration.cs deleted file mode 100644 index 4a274cfe93..0000000000 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultConfiguration.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Identity.Test.LabInfrastructure -{ - public class KeyVaultConfiguration - { - /// - /// The URL of the Key Vault instance. - /// - public string Url { get; set; } - - /// - /// The authentication type to use to communicate with the Key Vault. - /// - public LabAccessAuthenticationType AuthType { get; set; } - - /// - /// The ID of the test harness client. - /// - /// - /// This should be configured as having access to the Key Vault instance specified at . - /// - public string ClientId { get; set; } - - /// - /// The thumbprint of the to use when - /// is . - /// - public string CertThumbprint { get; set; } - - /// - /// Secret value used to access Key Vault - /// - public string KeyVaultSecret { get; set; } - } - -} diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultSecretsProvider.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultSecretsProvider.cs index b054edd4b3..0079f2162d 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultSecretsProvider.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/KeyVaultSecretsProvider.cs @@ -29,33 +29,7 @@ public class KeyVaultSecretsProvider : IDisposable private CertificateClient _certificateClient; private SecretClient _secretClient; - /// Initialize the secrets provider with the "keyVault" configuration section. - /// - /// - /// Authentication using - /// 1. Register Azure AD application of "Web app / API" type. - /// To set up certificate based access to the application PowerShell should be used. - /// 2. Add an access policy entry to target Key Vault instance for this application. - /// - /// The "keyVault" configuration section should define: - /// "authType": "ClientCertificate" - /// "clientId": [client ID] - /// "certThumbprint": [certificate thumbprint] - /// - /// - /// Authentication using - /// 1. Register Azure AD application of "Native" type. - /// 2. Add to 'Required permissions' access to 'Azure Key Vault (AzureKeyVault)' API. - /// 3. When you run your native client application, it will automatically prompt user to enter Azure AD credentials. - /// 4. To successfully access keys/secrets in the Key Vault, the user must have specific permissions to perform those operations. - /// This could be achieved by directly adding an access policy entry to target Key Vault instance for this user - /// or an access policy entry for an Azure AD security group of which this user is a member of. - /// - /// The "keyVault" configuration section should define: - /// "authType": "UserCredential" - /// "clientId": [client ID] - /// - /// + public KeyVaultSecretsProvider(string keyVaultAddress = KeyVaultInstance.MSIDLab) { var credentials = GetKeyVaultCredentialAsync().GetAwaiter().GetResult(); diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/LabAuthenticationHelper.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/LabAuthenticationHelper.cs index abc5671352..25017568ec 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/LabAuthenticationHelper.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/LabAuthenticationHelper.cs @@ -70,10 +70,4 @@ public static async Task GetLabAccessTokenAsync(string authority, s } } - public enum LabAccessAuthenticationType - { - ClientCertificate, - ClientSecret, - UserCredential - } } diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/LabResponse.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/LabResponse.cs index 52371c0560..14dcc75470 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/LabResponse.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/LabResponse.cs @@ -26,16 +26,12 @@ public class LabApp [JsonProperty("redirecturi")] public string RedirectUri { get; set; } - [JsonProperty("signinaudience")] - public string Audience { get; set; } - // TODO: this is a list, but lab sends a string. Not used today, discuss with lab to return a list [JsonProperty("authority")] public string Authority { get; set; } [JsonProperty("defaultscopes")] public string DefaultScopes { get; set; } - } public class Lab @@ -46,16 +42,7 @@ public class Lab [JsonProperty("federationprovider")] public FederationProvider FederationProvider { get; set; } - [JsonProperty("credentialvaultkeyname")] - public string CredentialVaultkeyName { get; set; } - [JsonProperty("authority")] public string Authority { get; set; } } - - public class LabCredentialResponse - { - [JsonProperty("Value")] - public string Secret { get; set; } - } } diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/LabServiceApi.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/LabServiceApi.cs index 840412c50d..6bdd85355e 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/LabServiceApi.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/LabServiceApi.cs @@ -75,35 +75,13 @@ private Task RunQueryAsync(UserQuery query) if (string.IsNullOrEmpty(query.Upn)) { //Building user query - //Required parameters will be set to default if not supplied by the test code - - queryDict.Add( - LabApiConstants.MultiFactorAuthentication, - query.MFA != null ? - query.MFA.ToString() : - MFA.None.ToString()); - - queryDict.Add( - LabApiConstants.ProtectionPolicy, - query.ProtectionPolicy != null ? - query.ProtectionPolicy.ToString() : - ProtectionPolicy.None.ToString()); - + //Required parameters will be set to default if not supplied by the test code + if (query.UserType != null) { queryDict.Add(LabApiConstants.UserType, query.UserType.ToString()); } - - if (query.HomeDomain != null) - { - queryDict.Add(LabApiConstants.HomeDomain, query.HomeDomain.ToString()); - } - - if (query.HomeUPN != null) - { - queryDict.Add(LabApiConstants.HomeUPN, query.HomeUPN.ToString()); - } - + if (query.B2CIdentityProvider != null) { queryDict.Add(LabApiConstants.B2CProvider, query.B2CIdentityProvider.ToString()); @@ -168,17 +146,6 @@ internal async Task GetLabResponseAsync(string address) } } - public async Task GetUserSecretAsync(string lab) - { - Dictionary queryDict = new Dictionary - { - { "secret", lab } - }; - - string result = await SendLabRequestAsync(LabApiConstants.LabUserCredentialEndpoint, queryDict).ConfigureAwait(false); - return JsonConvert.DeserializeObject(result).Secret; - } - public async Task GetMSIHelperServiceTokenAsync() { if (_msiHelperApiAccessToken == null) diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/LabUser.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/LabUser.cs index c3b09f5e40..3d0ffc3473 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/LabUser.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/LabUser.cs @@ -18,18 +18,6 @@ public class LabUser [JsonProperty("upn")] public string Upn { get; set; } - [JsonProperty("displayname")] - public string DisplayName { get; set; } - - [JsonProperty("mfa")] - public MFA Mfa { get; set; } - - [JsonProperty("protectionpolicy")] - public ProtectionPolicy ProtectionPolicy { get; set; } - - [JsonProperty("homedomain")] - public HomeDomain HomeDomain { get; set; } - [JsonProperty("homeupn")] public string HomeUPN { get; set; } @@ -41,8 +29,6 @@ public class LabUser public FederationProvider FederationProvider { get; set; } - public string Credential { get; set; } - public string TenantId { get; set; } private string _password = null; diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/LabUserHelper.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/LabUserHelper.cs index 7ca5fc674a..d8e15a9c66 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/LabUserHelper.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/LabUserHelper.cs @@ -136,13 +136,7 @@ private static LabResponse MergeLabResponses(LabResponse primary, LabResponse se return primaryJson.ToObject(); } - - [Obsolete("Use GetSpecificUserAsync instead", true)] - public static Task GetLabUserDataForSpecificUserAsync(string upn) - { - throw new NotSupportedException(); - } - + public static async Task GetMSIEnvironmentVariablesAsync(string uri) { string result = await s_labService.GetLabResponseAsync(uri).ConfigureAwait(false); @@ -187,33 +181,6 @@ public static Task GetB2CLocalAccountAsync() return GetLabUserDataAsync(UserQuery.B2CLocalAccountUserQuery); } - public static Task GetB2CFacebookAccountAsync() - { - return GetLabUserDataAsync(UserQuery.B2CFacebookUserQuery); - } - - public static Task GetB2CGoogleAccountAsync() - { - return GetLabUserDataAsync(UserQuery.B2CGoogleUserQuery); - } - - public static async Task GetB2CMSAAccountAsync() - { - var response = await GetLabUserDataAsync(UserQuery.B2CMSAUserQuery).ConfigureAwait(false); - if (string.IsNullOrEmpty(response.User.HomeUPN) || - string.Equals("None", response.User.HomeUPN, StringComparison.OrdinalIgnoreCase)) - { - Debug.WriteLine($"B2C MSA HomeUPN set to UPN: {response.User.Upn}"); - response.User.HomeUPN = response.User.Upn; - } - return response; - } - - public static Task GetSpecificUserAsync(string upn) - { - return GetLabUserDataAsync(new UserQuery() { Upn = upn }); - } - public static Task GetArlingtonUserAsync() { var response = GetLabUserDataAsync(UserQuery.ArlingtonUserQuery); diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/UserQueryParameters.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/UserQueryParameters.cs index 0db9391351..d1270bcbd1 100644 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/UserQueryParameters.cs +++ b/tests/Microsoft.Identity.Test.LabInfrastructure/UserQueryParameters.cs @@ -9,10 +9,6 @@ namespace Microsoft.Identity.Test.LabInfrastructure public struct UserQuery { public UserType? UserType { get; set; } - public MFA? MFA { get; set; } - public ProtectionPolicy? ProtectionPolicy { get; set; } - public HomeDomain? HomeDomain { get; set; } - public HomeUPN? HomeUPN { get; set; } public B2CIdentityProvider? B2CIdentityProvider { get; set; } public FederationProvider? FederationProvider { get; set; } //Requires userType to be set to federated public AzureEnvironment? AzureEnvironment { get; set; } @@ -51,24 +47,6 @@ public struct UserQuery B2CIdentityProvider = LabInfrastructure.B2CIdentityProvider.Local }; - public static UserQuery B2CFacebookUserQuery => new UserQuery - { - UserType = LabInfrastructure.UserType.B2C, - B2CIdentityProvider = LabInfrastructure.B2CIdentityProvider.Facebook - }; - - public static UserQuery B2CGoogleUserQuery => new UserQuery - { - UserType = LabInfrastructure.UserType.B2C, - B2CIdentityProvider = LabInfrastructure.B2CIdentityProvider.Google - }; - - public static UserQuery B2CMSAUserQuery => new UserQuery - { - UserType = LabInfrastructure.UserType.B2C, - B2CIdentityProvider = LabInfrastructure.B2CIdentityProvider.MSA - }; - public static UserQuery ArlingtonUserQuery => new UserQuery { UserType = LabInfrastructure.UserType.Cloud, diff --git a/tests/Microsoft.Identity.Test.LabInfrastructure/UserType.cs b/tests/Microsoft.Identity.Test.LabInfrastructure/UserType.cs deleted file mode 100644 index 86e69e2139..0000000000 --- a/tests/Microsoft.Identity.Test.LabInfrastructure/UserType.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Identity.Test.LabInfrastructure -{ - -}