diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-13 23:09:44 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-13 23:09:44 +0200 |
| commit | 678b22afc27e53811f978103b7ea41609ff68606 (patch) | |
| tree | faaabb6468c1b22d770eb753eeac39b34ef65e4f /Software/Visual_Studio/Azure | |
| parent | 69f27fd4bfc5a46fad019b06c9c8d06159c400b9 (diff) | |
| download | Tango-678b22afc27e53811f978103b7ea41609ff68606.tar.gz Tango-678b22afc27e53811f978103b7ea41609ff68606.zip | |
Implemented and deployed machine service gateway.
Implemented AzureUtils => Gateway.
Diffstat (limited to 'Software/Visual_Studio/Azure')
19 files changed, 367 insertions, 253 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/App.config b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/App.config index f97c59da6..a142ac2b3 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/App.config +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/App.config @@ -1,9 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> -<configuration> +<configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> + + <appSettings> + <add key="GatewayUrl" value="https://machineservice-gateway.azurewebsites.net/" /> + </appSettings> + <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> </startup> @@ -73,6 +78,14 @@ <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" /> </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.UI/AzureDashboardViewModel.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs index 3c6a95ebf..eddc7d009 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.AzureUtils.UI.Managers; using Tango.Core.DI; +using Tango.Settings; using Tango.SharedUI; namespace Tango.AzureUtils.UI @@ -17,9 +18,16 @@ namespace Tango.AzureUtils.UI [TangoInject] public IStatusManager StatusManager { get; set; } - public virtual void OnApplicationReady() + public AzureUtilsSettings Settings { get; set; } + + public AzureDashboardViewModel() { + Settings = SettingsManager.Default.GetOrCreate<AzureUtilsSettings>(); + } + public virtual void OnApplicationReady() + { + } public virtual void OnAuthenticated(IAzure azure, List<IWebAppBase> apps) diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureUtilsSettings.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureUtilsSettings.cs new file mode 100644 index 000000000..b6ed1845d --- /dev/null +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureUtilsSettings.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Cryptography; +using Tango.Settings; + +namespace Tango.AzureUtils.UI +{ + public class AzureUtilsSettings : SettingsBase + { + private Rfc2898Cryptographer _crypt; + + public AzureUtilsSettings() + { + _crypt = new Rfc2898Cryptographer(); + } + + public String Email { get; set; } + + public String EncryptedPassword { get; set; } + + [JsonIgnore] + public String Password + { + get + { + return _crypt.Decrypt(EncryptedPassword); + } + set + { + EncryptedPassword = _crypt.Encrypt(value); + } + } + } +} diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj index 8f0546bfa..985c54c00 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj @@ -56,80 +56,80 @@ <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.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> @@ -166,6 +166,7 @@ </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.IdentityModel" /> @@ -194,6 +195,7 @@ <SubType>Designer</SubType> </ApplicationDefinition> <Compile Include="AzureDashboardViewModel.cs" /> + <Compile Include="AzureUtilsSettings.cs" /> <Compile Include="Controls\WebAppPropertiesControl.xaml.cs"> <DependentUpon>WebAppPropertiesControl.xaml</DependentUpon> </Compile> @@ -311,6 +313,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> <Project>{8491D07B-C1F6-4B62-A412-41B9FD2D6538}</Project> <Name>Tango.SharedUI</Name> diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs index 7c3abd169..a4c65fcdd 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs @@ -41,23 +41,6 @@ namespace Tango.AzureUtils.UI.ViewModels set { _slotName = value; RaisePropertyChangedAuto(); } } - private String _email; - [Required(ErrorMessage = "Active directory email is required.")] - [EmailAddress(ErrorMessage = "Please enter a valid email.")] - public String Email - { - get { return _email; } - set { _email = value; RaisePropertyChangedAuto(); } - } - - private String _password; - [Required(ErrorMessage = "Password is required.")] - public String Password - { - get { return _password; } - set { _password = value; RaisePropertyChangedAuto(); } - } - private CreateEnvironmentConfiguration _config; public CreateEnvironmentConfiguration Config { @@ -73,11 +56,6 @@ namespace Tango.AzureUtils.UI.ViewModels Config = new CreateEnvironmentConfiguration(); } - public override void OnApplicationReady() - { - Email = "roy@twine-s.com"; - } - public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps) { _machineServiceApp = apps.SingleOrDefault(x => x.Name == "MachineService"); @@ -97,8 +75,8 @@ namespace Tango.AzureUtils.UI.ViewModels IsFree = false; - Config.Email = Email; - Config.Password = Password; + Config.Email = Settings.Email; + Config.Password = Settings.Password; await _environmentManager.CreateEnvironment(_machineServiceApp as IWebApp, SelectedDeploymentSlot, SlotName, Config); } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs index e8d966158..0917b012d 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs @@ -39,23 +39,6 @@ namespace Tango.AzureUtils.UI.ViewModels set { _slotName = value; RaisePropertyChangedAuto(); } } - private String _email; - [Required(ErrorMessage = "Active directory email is required.")] - [EmailAddress(ErrorMessage = "Please enter a valid email.")] - public String Email - { - get { return _email; } - set { _email = value; RaisePropertyChangedAuto(); } - } - - private String _password; - [Required(ErrorMessage = "Password is required.")] - public String Password - { - get { return _password; } - set { _password = value; RaisePropertyChangedAuto(); } - } - private RemoveEnvironmentConfiguration _config; public RemoveEnvironmentConfiguration Config { @@ -71,12 +54,6 @@ namespace Tango.AzureUtils.UI.ViewModels Config = new RemoveEnvironmentConfiguration(); } - public override void OnApplicationReady() - { - Email = "roy@twine-s.com"; - Password = "1Creativity"; - } - public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps) { _machineServiceApp = apps.SingleOrDefault(x => x.Name == "MachineService"); @@ -96,8 +73,8 @@ namespace Tango.AzureUtils.UI.ViewModels IsFree = false; - Config.Email = Email; - Config.Password = Password; + Config.Email = Settings.Email; + Config.Password = Settings.Password; await _environmentManager.RemoveEnvironment(SelectedDeploymentSlot, SlotName, Config); diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/MainViewVM.cs index 4faf1369f..69543cb5a 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/MainViewVM.cs @@ -2,6 +2,7 @@ using Microsoft.Azure.Management.Fluent; using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,6 +10,7 @@ using System.Windows.Input; using Tango.AzureUtils.Deployment; using Tango.AzureUtils.UI.Managers; using Tango.Core.Commands; +using Tango.Core.Cryptography; using Tango.Core.DI; using Tango.SharedUI; @@ -34,6 +36,21 @@ namespace Tango.AzureUtils.UI.ViewModels set { _progress = value; RaisePropertyChangedAuto(); } } + private String _email; + public String Email + { + get { return _email; } + set { _email = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private String _password; + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + #endregion #region Commands @@ -44,7 +61,14 @@ namespace Tango.AzureUtils.UI.ViewModels public MainViewVM() { - InitCommand = new RelayCommand(Init, () => !IsInitialized); + InitCommand = new RelayCommand(Init, () => !IsInitialized && !String.IsNullOrWhiteSpace(Email) && !String.IsNullOrWhiteSpace(Password)); + + try + { + Email = Settings.Email; + Password = Settings.Password; + } + catch { } } public override void OnApplicationReady() @@ -65,7 +89,12 @@ namespace Tango.AzureUtils.UI.ViewModels IsFree = false; StatusManager.UpdateStatus(AzureUtilsStage.Initializing, "Authenticating...", true); - _azure = await AzureUtilsAuthenticationFactory.AuthenticateOrGetAsync(); + _azure = await AzureUtilsAuthenticationFactory.AuthenticateOrGetAsync(ConfigurationManager.AppSettings.Get("GatewayUrl"), Email, Password); + + Settings.Email = Email; + Settings.Password = Password; + Settings.Save(); + List<IWebAppBase> allApps = new List<IWebAppBase>(); diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml index 068e96318..05f917e5b 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml @@ -51,16 +51,10 @@ </GroupBox> <StackPanel> - <GroupBox HorizontalAlignment="Left" Margin="50 10 10 10" Header="Environment Name/Credentials" Padding="10 10 90 10"> + <GroupBox HorizontalAlignment="Left" Margin="50 10 10 10" Header="Environment Name" Padding="10 10 90 10"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="300"> <TextBlock FontSize="10">Environment Name (e.g DEV)</TextBlock> <TextBox Margin="0 2 0 0" Text="{Binding SlotName}"></TextBox> - - <TextBlock FontSize="10" Margin="0 10 0 0">Active Directory Administrator Email</TextBlock> - <TextBox Margin="0 2 0 0" Text="{Binding Email}"></TextBox> - - <TextBlock Margin="0 10 0 0" FontSize="10">Password</TextBlock> - <PasswordBox Margin="0 2 0 0" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"></PasswordBox> </StackPanel> </GroupBox> diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRemovalView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRemovalView.xaml index 2175aaaf3..3eed6575e 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRemovalView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRemovalView.xaml @@ -41,16 +41,10 @@ </GroupBox> <StackPanel> - <GroupBox HorizontalAlignment="Left" Margin="50 10 10 10" Header="Environment Credentials" Padding="10 10 90 10"> + <GroupBox HorizontalAlignment="Left" Margin="50 10 10 10" Header="Environment Name" Padding="10 10 90 10"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="300"> <TextBlock FontSize="10">Environment Name (e.g DEV)</TextBlock> <TextBox Margin="0 2 0 0" Text="{Binding SlotName}"></TextBox> - - <TextBlock FontSize="10" Margin="0 10 0 0">Active Directory Administrator Email</TextBlock> - <TextBox Margin="0 2 0 0" Text="{Binding Email}"></TextBox> - - <TextBlock Margin="0 10 0 0" FontSize="10">Password</TextBlock> - <PasswordBox Margin="0 2 0 0" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"></PasswordBox> </StackPanel> </GroupBox> diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml index 40d431be1..b79d306d1 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.AzureUtils.UI.ViewModels" xmlns:global="clr-namespace:Tango.AzureUtils.UI" xmlns:views="clr-namespace:Tango.AzureUtils.UI.Views" @@ -24,7 +25,21 @@ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 0 0 0" FontSize="50">Azure Utils</TextBlock> - <Button Command="{Binding InitCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="30 10" Margin="10">Authenticate</Button> + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" IsEnabled="{Binding IsInitialized,Converter={StaticResource BooleanInverseConverter}}"> + + <StackPanel> + <StackPanel VerticalAlignment="Center" Width="150"> + <TextBlock FontSize="10" Margin="0 10 0 0">Email</TextBlock> + <TextBox Margin="0 2 0 0" Text="{Binding Email}"></TextBox> + </StackPanel> + + <StackPanel VerticalAlignment="Center" Width="150"> + <TextBlock Margin="0 5 0 0" FontSize="10">Password</TextBlock> + <PasswordBox Margin="0 2 0 0" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"></PasswordBox> + </StackPanel> + </StackPanel> + <Button Command="{Binding InitCommand}" VerticalAlignment="Center" Padding="30 19" Margin="20 14 10 10" IsDefault="True">Authenticate</Button> + </StackPanel> <Grid Grid.Row="1" IsEnabled="{Binding IsInitialized}"> <TabControl Margin="10"> diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/packages.config b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/packages.config index 14a601db9..95f192e49 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/packages.config +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/packages.config @@ -6,31 +6,31 @@ <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.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.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.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.IdentityModel.Clients.ActiveDirectory" version="4.3.0" targetFramework="net461" /> 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" /> |
