From 9736b8c8ede6a0d121dea8381f0abb561fad5631 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 19 Feb 2019 01:50:58 +0200 Subject: Implemented auto generated web clients for PPC and machine studio. Improved interactions with web clients across solutions. --- .../DefaultAuthenticationProvider.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index d81f0d561..e07952f29 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -26,6 +26,8 @@ namespace Tango.MachineStudio.UI.Authentication /// public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { + private MachineStudioWebClient _client; + private User _currentUser; /// /// Gets the current logged-in user. @@ -46,6 +48,15 @@ namespace Tango.MachineStudio.UI.Authentication /// public event EventHandler CurrentUserChanged; + /// + /// Initializes a new instance of the class. + /// + /// The machine studio web client. + public DefaultAuthenticationProvider(MachineStudioWebClient machineStudioWebClient) + { + _client = machineStudioWebClient; + } + /// /// Performs a user login by the specified email and password. /// @@ -57,9 +68,8 @@ namespace Tango.MachineStudio.UI.Authentication { var settings = SettingsManager.Default.GetOrCreate(); - IMachineStudioWebService service = new MachineStudioWebService(); - - var response = service.Login(new LoginRequest() + _client.Environment = settings.DeploymentSlot; + var response = _client.Login(new LoginRequest() { Email = email, @@ -68,8 +78,6 @@ namespace Tango.MachineStudio.UI.Authentication }).Result; - AccessToken = response.AccessToken; - if (settings.Environment == MachineStudioSettings.WorkingEnvironment.Remote) { ObservablesContext.OverrideSettingsDataSource(response.DataSource); @@ -114,10 +122,5 @@ namespace Tango.MachineStudio.UI.Authentication { CurrentUser = null; } - - /// - /// Gets the access token that was retrieved at the last login. - /// - public string AccessToken { get; private set; } } } -- cgit v1.3.1