aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure/Tango.AzureUtils
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-13 23:09:44 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-13 23:09:44 +0200
commit678b22afc27e53811f978103b7ea41609ff68606 (patch)
treefaaabb6468c1b22d770eb753eeac39b34ef65e4f /Software/Visual_Studio/Azure/Tango.AzureUtils
parent69f27fd4bfc5a46fad019b06c9c8d06159c400b9 (diff)
downloadTango-678b22afc27e53811f978103b7ea41609ff68606.tar.gz
Tango-678b22afc27e53811f978103b7ea41609ff68606.zip
Implemented and deployed machine service gateway.
Implemented AzureUtils => Gateway.
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/ActiveDirectory/ActiveDirectoryManager.cs4
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsAuthenticationFactory.cs49
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj102
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/Web/AzureUtilsWebClient.cs44
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginRequest.cs13
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginResponse.cs12
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/app.config8
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/packages.config50
8 files changed, 172 insertions, 110 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/ActiveDirectory/ActiveDirectoryManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/ActiveDirectory/ActiveDirectoryManager.cs
index 26ce44b90..fad95df28 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/ActiveDirectory/ActiveDirectoryManager.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/ActiveDirectory/ActiveDirectoryManager.cs
@@ -34,7 +34,7 @@ namespace Tango.AzureUtils.ActiveDirectory
{
if (_adClient == null)
{
- var credentials = AzureUtilsAuthenticationFactory.GetCredentials();
+ var credentials = AzureUtilsAuthenticationFactory.GetGlobalCredentials();
_adClient = new ActiveDirectoryClient(new Uri($"https://graph.windows.net/{credentials.TenantID}"), async () => await Task.FromResult(_authResult.AccessToken));
}
return _adClient;
@@ -70,7 +70,7 @@ namespace Tango.AzureUtils.ActiveDirectory
OnProgress(AzureUtilsStage.ActiveDirectory, $"Authenticating with active directory graph...");
if (_authResult == null)
{
- var credentials = AzureUtilsAuthenticationFactory.GetCredentials();
+ var credentials = AzureUtilsAuthenticationFactory.GetGlobalCredentials();
var authContext = new AuthenticationContext($"https://login.microsoftonline.com/{credentials.TenantID}");
authContext.TokenCache.Clear();
UserCredential userCredential = new UserPasswordCredential(email, password);
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsAuthenticationFactory.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsAuthenticationFactory.cs
index 0d8b2ccfc..2006b492f 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsAuthenticationFactory.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsAuthenticationFactory.cs
@@ -3,8 +3,10 @@ using Microsoft.Azure.Management.ResourceManager.Fluent;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
+using Tango.AzureUtils.Web;
namespace Tango.AzureUtils
{
@@ -19,13 +21,18 @@ namespace Tango.AzureUtils
SubscriptionID = "10c8aa60-3b15-4e0d-b412-6aeef90e5e91"
};
- public static void SetCredentials(AzureUtilsCredentials credentials)
+ public static void SetGlobalCredentials(AzureUtilsCredentials credentials)
{
_credentials = credentials;
}
public static Task<IAzure> AuthenticateOrGetAsync()
{
+ if (_credentials == null)
+ {
+ throw new NullReferenceException("Credentials were not set.");
+ }
+
if (_azure == null)
{
return Task.Factory.StartNew<IAzure>(() =>
@@ -46,7 +53,45 @@ namespace Tango.AzureUtils
}
}
- public static AzureUtilsCredentials GetCredentials()
+ public static Task<IAzure> AuthenticateOrGetAsync(AzureUtilsCredentials credentials)
+ {
+ return Task.Factory.StartNew<IAzure>(() =>
+ {
+ var creds = SdkContext.AzureCredentialsFactory.FromServicePrincipal(
+ credentials.ClientID,
+ credentials.ClientSecret,
+ credentials.TenantID,
+ AzureEnvironment.AzureGlobalCloud);
+
+ _azure = Azure.Authenticate(creds).WithSubscription(credentials.SubscriptionID);
+ return _azure;
+ });
+ }
+
+ public static async Task<IAzure> AuthenticateOrGetAsync(String gatewayUrl, String email, String password)
+ {
+ using (var http = new HttpClient())
+ {
+ AzureUtilsWebClient client = new AzureUtilsWebClient(gatewayUrl, http);
+ var response = await client.LoginAsync(new LoginRequest()
+ {
+ Email = email,
+ Password = password
+ });
+
+ http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", response.AccessToken);
+ var c = await client.GetCredentialsAsync();
+ return await AuthenticateOrGetAsync(new AzureUtilsCredentials()
+ {
+ ClientID = c.ClientID,
+ ClientSecret = c.ClientSecret,
+ TenantID = c.TenantID,
+ SubscriptionID = c.SubscriptionID
+ });
+ }
+ }
+
+ public static AzureUtilsCredentials GetGlobalCredentials()
{
return _credentials;
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj b/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj
index 11d589570..4a8daf233 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj
@@ -64,83 +64,83 @@
<Reference Include="Microsoft.Azure.KeyVault.WebKey, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.WebKey.3.0.1\lib\net452\Microsoft.Azure.KeyVault.WebKey.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.AppService.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.AppService.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.AppService.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.AppService.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.AppService.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.AppService.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.BatchAI.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.BatchAI.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.BatchAI.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.BatchAI.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.BatchAI.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.BatchAI.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Cdn.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Cdn.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Cdn.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Cdn.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Cdn.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Cdn.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Compute.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Compute.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Compute.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Compute.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Compute.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Compute.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.ContainerInstance.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerInstance.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.ContainerInstance.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.ContainerInstance.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerInstance.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.ContainerInstance.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.ContainerRegistry.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerRegistry.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.ContainerRegistry.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.ContainerRegistry.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerRegistry.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.ContainerRegistry.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.ContainerService.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerService.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.ContainerService.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.ContainerService.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.ContainerService.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.ContainerService.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.CosmosDB.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.CosmosDB.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.CosmosDB.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.CosmosDB.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.CosmosDB.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.CosmosDB.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Dns.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Dns.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Dns.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Dns.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Dns.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Dns.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.EventHub.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.EventHub.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.EventHub.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.EventHub.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.EventHub.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.EventHub.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Graph.RBAC.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Graph.RBAC.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Graph.RBAC.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Graph.RBAC.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Graph.RBAC.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Graph.RBAC.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.KeyVault.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.KeyVault.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.KeyVault.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.KeyVault.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.KeyVault.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.KeyVault.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Locks.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Locks.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Locks.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Locks.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Locks.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Locks.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Monitor.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Monitor.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Monitor.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Monitor.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Monitor.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Monitor.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Msi.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Msi.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Msi.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Msi.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Msi.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Msi.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Network.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Network.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Network.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Network.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Network.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Network.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.PrivateDns.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.PrivateDns.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.PrivateDns.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.PrivateDns.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.PrivateDns.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.PrivateDns.Fluent.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.RecoveryServices.Backup, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Management.RecoveryServices.Backup.0.1.2\lib\net40\Microsoft.Azure.Management.RecoveryServices.Backup.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Redis.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Redis.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Redis.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Redis.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Redis.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Redis.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.ResourceManager.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.ResourceManager.Fluent.1.30.0\lib\net461\Microsoft.Azure.Management.ResourceManager.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.ResourceManager.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.ResourceManager.Fluent.1.31.0\lib\net461\Microsoft.Azure.Management.ResourceManager.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Search.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Search.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Search.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Search.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Search.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Search.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.ServiceBus.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.ServiceBus.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.ServiceBus.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.ServiceBus.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Sql.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Sql.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Sql.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Sql.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Sql.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Sql.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.Storage.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.Storage.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.Storage.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.Storage.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.Storage.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.Storage.Fluent.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Azure.Management.TrafficManager.Fluent, Version=1.0.0.63, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Microsoft.Azure.Management.TrafficManager.Fluent.1.30.0\lib\net452\Microsoft.Azure.Management.TrafficManager.Fluent.dll</HintPath>
+ <Reference Include="Microsoft.Azure.Management.TrafficManager.Fluent, Version=1.0.0.64, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.Azure.Management.TrafficManager.Fluent.1.31.0\lib\net452\Microsoft.Azure.Management.TrafficManager.Fluent.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Storage.Blob, Version=11.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.Blob.11.1.2\lib\net452\Microsoft.Azure.Storage.Blob.dll</HintPath>
@@ -253,6 +253,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Storage\StorageManager.cs" />
<Compile Include="Web\AzureUtilsWebClient.cs" />
+ <Compile Include="Web\LoginRequest.cs" />
+ <Compile Include="Web\LoginResponse.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\DB\SQLExaminer Projects\GENERAL_ENV_UPGRADE.sdeproj">
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/AzureUtilsWebClient.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/AzureUtilsWebClient.cs
index 531bfb248..d62854987 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/AzureUtilsWebClient.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/AzureUtilsWebClient.cs
@@ -123,31 +123,31 @@ namespace Tango.AzureUtils.Web
}
/// <exception cref="ApiException">A server side error occurred.</exception>
- public System.Threading.Tasks.Task DoSomethingSecretAsync()
+ public System.Threading.Tasks.Task<AzureUtilsCredentials> GetCredentialsAsync()
{
- return DoSomethingSecretAsync(System.Threading.CancellationToken.None);
+ return GetCredentialsAsync(System.Threading.CancellationToken.None);
}
/// <exception cref="ApiException">A server side error occurred.</exception>
- public void DoSomethingSecret()
+ public AzureUtilsCredentials GetCredentials()
{
- System.Threading.Tasks.Task.Run(async () => await DoSomethingSecretAsync(System.Threading.CancellationToken.None)).GetAwaiter().GetResult();
+ return System.Threading.Tasks.Task.Run(async () => await GetCredentialsAsync(System.Threading.CancellationToken.None)).GetAwaiter().GetResult();
}
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="ApiException">A server side error occurred.</exception>
- public async System.Threading.Tasks.Task DoSomethingSecretAsync(System.Threading.CancellationToken cancellationToken)
+ public async System.Threading.Tasks.Task<AzureUtilsCredentials> GetCredentialsAsync(System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/AzureUtils/DoSomethingSecret");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/AzureUtils/GetCredentials");
var client_ = _httpClient;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
- request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json");
- request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Method = new System.Net.Http.HttpMethod("GET");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
@@ -167,9 +167,10 @@ namespace Tango.AzureUtils.Web
ProcessResponse(client_, response_);
var status_ = ((int)response_.StatusCode).ToString();
- if (status_ == "204")
+ if (status_ == "200")
{
- return;
+ var objectResponse_ = await ReadObjectResponseAsync<AzureUtilsCredentials>(response_, headers_).ConfigureAwait(false);
+ return objectResponse_.Object;
}
else
if (status_ != "200" && status_ != "204")
@@ -177,6 +178,8 @@ namespace Tango.AzureUtils.Web
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
}
+
+ return default(AzureUtilsCredentials);
}
finally
{
@@ -359,27 +362,6 @@ namespace Tango.AzureUtils.Web
}
}
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")]
- public partial class LoginResponse
- {
- [Newtonsoft.Json.JsonProperty("AccessToken", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string AccessToken { get; set; }
-
-
- }
-
- [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")]
- public partial class LoginRequest
- {
- [Newtonsoft.Json.JsonProperty("Email", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string Email { get; set; }
-
- [Newtonsoft.Json.JsonProperty("Password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string Password { get; set; }
-
-
- }
-
/// <summary>Contains information for a single HTTP operation.</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class HttpControllerContext
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginRequest.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginRequest.cs
new file mode 100644
index 000000000..e06281a5b
--- /dev/null
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Tango.AzureUtils.Web
+{
+ public class LoginRequest
+ {
+ public String Email { get; set; }
+ public String Password { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginResponse.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginResponse.cs
new file mode 100644
index 000000000..a3be17700
--- /dev/null
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Web/LoginResponse.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Tango.AzureUtils.Web
+{
+ public class LoginResponse
+ {
+ public String AccessToken { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/app.config b/Software/Visual_Studio/Azure/Tango.AzureUtils/app.config
index 9c4bc82cf..104b683be 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/app.config
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/app.config
@@ -34,6 +34,14 @@
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/packages.config b/Software/Visual_Studio/Azure/Tango.AzureUtils/packages.config
index 57597d222..09feb04cd 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/packages.config
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/packages.config
@@ -10,32 +10,32 @@
<package id="Microsoft.Azure.KeyVault" version="3.0.1" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.WebKey" version="3.0.1" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.AppService.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.BatchAI.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Cdn.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Compute.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.ContainerInstance.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.ContainerRegistry.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.ContainerService.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.CosmosDB.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Dns.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.EventHub.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Graph.RBAC.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.KeyVault.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Locks.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Monitor.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Msi.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Network.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.PrivateDns.Fluent" version="1.30.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.AppService.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.BatchAI.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Cdn.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Compute.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.ContainerInstance.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.ContainerRegistry.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.ContainerService.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.CosmosDB.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Dns.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.EventHub.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Graph.RBAC.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.KeyVault.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Locks.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Monitor.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Msi.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Network.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.PrivateDns.Fluent" version="1.31.0" targetFramework="net461" />
<package id="Microsoft.Azure.Management.RecoveryServices.Backup" version="0.1.2" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Redis.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.ResourceManager.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Search.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.ServiceBus.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Sql.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.Storage.Fluent" version="1.30.0" targetFramework="net461" />
- <package id="Microsoft.Azure.Management.TrafficManager.Fluent" version="1.30.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Redis.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.ResourceManager.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Search.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.ServiceBus.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Sql.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.Storage.Fluent" version="1.31.0" targetFramework="net461" />
+ <package id="Microsoft.Azure.Management.TrafficManager.Fluent" version="1.31.0" targetFramework="net461" />
<package id="Microsoft.Azure.Storage.Blob" version="11.1.2" targetFramework="net461" />
<package id="Microsoft.Azure.Storage.Common" version="11.1.2" targetFramework="net461" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net461" />