diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-19 11:19:21 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-19 11:19:21 +0200 |
| commit | 93e6a6bfa7238826dcdea989e279ec3450067f83 (patch) | |
| tree | 212b5023935862346a7de311e37cf1ef727efcd5 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs | |
| parent | e99efd9d9b7b67a76db82a9a40525f96bcf064c0 (diff) | |
| parent | 3fcd0dbc6650749421f0390a60154c52254682e6 (diff) | |
| download | Tango-93e6a6bfa7238826dcdea989e279ec3450067f83.tar.gz Tango-93e6a6bfa7238826dcdea989e279ec3450067f83.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs | 24 |
1 files changed, 14 insertions, 10 deletions
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 9be938fb7..e07952f29 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -15,6 +15,7 @@ using Tango.Settings; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.StudioApplication; using Tango.Core.Helpers; +using Tango.MachineStudio.Common.Web; namespace Tango.MachineStudio.UI.Authentication { @@ -25,6 +26,8 @@ namespace Tango.MachineStudio.UI.Authentication /// <seealso cref="Tango.MachineStudio.Common.Authentication.IAuthenticationProvider" /> public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { + private MachineStudioWebClient _client; + private User _currentUser; /// <summary> /// Gets the current logged-in user. @@ -46,6 +49,15 @@ namespace Tango.MachineStudio.UI.Authentication public event EventHandler<User> CurrentUserChanged; /// <summary> + /// Initializes a new instance of the <see cref="DefaultAuthenticationProvider"/> class. + /// </summary> + /// <param name="machineStudioWebClient">The machine studio web client.</param> + public DefaultAuthenticationProvider(MachineStudioWebClient machineStudioWebClient) + { + _client = machineStudioWebClient; + } + + /// <summary> /// Performs a user login by the specified email and password. /// </summary> /// <param name="email">The email.</param> @@ -56,9 +68,8 @@ namespace Tango.MachineStudio.UI.Authentication { var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); - - IWebTransportClient service = new WebTransportClient(); - var response = service.PostJson<LoginRequest, LoginResponse>(settings.GetMachineServiceAddress() + "/api/MachineStudio/Login", new LoginRequest() + _client.Environment = settings.DeploymentSlot; + var response = _client.Login(new LoginRequest() { Email = email, @@ -67,8 +78,6 @@ namespace Tango.MachineStudio.UI.Authentication }).Result; - AccessToken = response.Token; - if (settings.Environment == MachineStudioSettings.WorkingEnvironment.Remote) { ObservablesContext.OverrideSettingsDataSource(response.DataSource); @@ -113,10 +122,5 @@ namespace Tango.MachineStudio.UI.Authentication { CurrentUser = null; } - - /// <summary> - /// Gets the access token that was retrieved at the last login. - /// </summary> - public string AccessToken { get; private set; } } } |
