diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-12-23 12:44:08 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-12-23 12:44:08 +0200 |
| commit | 4e496467dcc8549605917a44263d78cef40f71bb (patch) | |
| tree | 3e385e90ec94c5f7d590aaa71991b40fcc05df67 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication | |
| parent | 5cb09f7732429d15477321e7f748d010ef27c85d (diff) | |
| download | Tango-4e496467dcc8549605917a44263d78cef40f71bb.tar.gz Tango-4e496467dcc8549605917a44263d78cef40f71bb.zip | |
Implemented machine studio active directory secure login.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs | 19 |
1 files changed, 16 insertions, 3 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 fd68ed8d1..3293dab3f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -10,6 +10,9 @@ using Tango.MachineStudio.Common.Authentication; using Tango.BL; using Tango.BL.Enumerations; using System.Data.Entity; +using Tango.Transport.Web; +using Tango.Settings; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.Authentication { @@ -49,11 +52,21 @@ namespace Tango.MachineStudio.UI.Authentication /// <exception cref="AuthenticationException">Login failed for user " + email</exception> public User Login(string email, string password) { - using (ObservablesContext db = ObservablesContext.CreateDefault()) + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + IWebTransportClient service = new WebTransportClient(); + var response = service.PostJson<LoginRequest, LoginResponse>(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest() { - String hash = User.GetPasswordHash(password); + Email = email, + Password = password, + + }).Result; + ObservablesContext.OverrideSettingsDataSource(response.DataSource); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { db.Roles.Load(); db.Permissions.Load(); db.RolesPermissions.Load(); @@ -62,7 +75,7 @@ namespace Tango.MachineStudio.UI.Authentication .Include(x => x.UsersRoles) .Include(x => x.Contact) .Include(x => x.Address) - .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower() && x.Password == hash); + .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower()); if (user == null) { |
