Changeset 1737
- Timestamp:
- 05/04/09 19:42:18 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HLUserAdapter.cs
r1729 r1737 55 55 56 56 if (!row.IsPasswordNull()) 57 user. Password = row.Password;57 user.SetPlainPassword(row.Password); 58 58 else 59 user. Password = String.Empty;59 user.SetPlainPassword(String.Empty); 60 60 61 61 if (!row.IsMailAddressNull()) -
trunk/sources/HeuristicLab.Security.Contracts/3.2/BusinessObjects/User.cs
r1656 r1737 24 24 using System.Text; 25 25 using System.Runtime.Serialization; 26 using System.Security.Cryptography; 26 27 27 28 namespace HeuristicLab.Security.Contracts.BusinessObjects { … … 29 30 [DataContract] 30 31 public class User : PermissionOwner { 32 private static string getMd5Hash(string input) { 33 // Create a new instance of the MD5CryptoServiceProvider object. 34 MD5 md5Hasher = MD5.Create(); 35 36 // Convert the input string to a byte array and compute the hash. 37 byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input)); 38 39 // Create a new Stringbuilder to collect the bytes 40 // and create a string. 41 StringBuilder sBuilder = new StringBuilder(); 42 43 // Loop through each byte of the hashed data 44 // and format each one as a hexadecimal string. 45 for (int i = 0; i < data.Length; i++) { 46 sBuilder.Append(data[i].ToString("x2")); 47 } 48 49 // Return the hexadecimal string. 50 return sBuilder.ToString(); 51 } 52 53 31 54 [DataMember] 32 55 public String Login { get; set; } 56 57 private String password; 58 33 59 [DataMember] 34 public String Password { get; set; } 60 public String Password { 61 get { 62 return this.password; 63 } 64 set { 65 this.password = getMd5Hash(value); 66 } 67 } 68 69 public void SetPlainPassword(String password) { 70 this.password = password; 71 } 72 35 73 [DataMember] 36 74 public String MailAddress { get; set; } -
trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/IPermissionManager.cs
r1735 r1737 19 19 void EndSession(Guid sessionId); 20 20 21 [OperationContract]22 [FaultContractAttribute(typeof(CommunicationException))]23 void TestServer();24 21 } 25 22 } -
trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs
r1736 r1737 8 8 using HeuristicLab.DataAccess.Interfaces; 9 9 using HeuristicLab.PluginInfrastructure; 10 using System.Security.Cryptography; 10 11 11 12 namespace HeuristicLab.Security.Core { … … 19 20 Object locker = new Object(); 20 21 21 22 private static string getMd5Hash(string input) { 23 // Create a new instance of the MD5CryptoServiceProvider object. 24 MD5 md5Hasher = MD5.Create(); 25 26 // Convert the input string to a byte array and compute the hash. 27 byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input)); 28 29 // Create a new Stringbuilder to collect the bytes 30 // and create a string. 31 StringBuilder sBuilder = new StringBuilder(); 32 33 // Loop through each byte of the hashed data 34 // and format each one as a hexadecimal string. 35 for (int i = 0; i < data.Length; i++) { 36 sBuilder.Append(data[i].ToString("x2")); 37 } 38 39 // Return the hexadecimal string. 40 return sBuilder.ToString(); 41 } 42 22 43 /// <summary> 23 44 /// If a session exists for this userName then it is returned, otherwise the given password … … 34 55 session = factory.GetSessionForCurrentThread(); 35 56 57 password = getMd5Hash(password); 58 36 59 IUserAdapter userAdapter = session.GetDataAdapter<User, IUserAdapter>(); 37 60 User user = userAdapter.GetByLogin(userName); 38 61 39 if (user.Password.CompareTo(password) == 0) { 62 if (user != null && 63 user.Password.Equals(password)) { 40 64 Guid newSessionId = Guid.NewGuid(); 41 65 lock (locker) … … 105 129 return Guid.Empty; 106 130 } 107 108 public void TestServer() {109 }110 131 } 111 132 } -
trunk/sources/HeuristicLab.Security.Server/3.2/SecurityServer.cs
r1713 r1737 10 10 namespace HeuristicLab.Security.Server { 11 11 public partial class SecurityServer : Form { 12 public SecurityServer(Dictionary<string, Uri> baseAddrDict) {12 public SecurityServer(Dictionary<string, String> baseAddrDict) { 13 13 InitializeComponent(); 14 Uriuri;14 String uri; 15 15 baseAddrDict.TryGetValue(SecurityServerApplication.STR_PermissionManager, out uri); 16 16 if (uri != null) -
trunk/sources/HeuristicLab.Security.Server/3.2/SecurityServerApplication.cs
r1713 r1737 44 44 } 45 45 46 private UriStartService(Services svc, IPAddress ipAddress, int port) {46 private String StartService(Services svc, IPAddress ipAddress, int port) { 47 47 string curServiceHost = ""; 48 48 Uri uriTcp; 49 String result = ""; 49 50 ISecurityManager[] securityManagerInstances = discService.GetInstances<ISecurityManager>(); 50 51 IPermissionManager[] permissionManagerInstances = discService.GetInstances<IPermissionManager>(); … … 53 54 case Services.PermissionManager: 54 55 if (securityManagerInstances.Length > 0) { 55 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/ PermissionManager/");56 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/SecurityServer/"); 56 57 serviceHost = new ServiceHost(permissionManagerInstances[0].GetType(), uriTcp); 57 58 serviceHost.AddServiceEndpoint(typeof(IPermissionManager), binding, STR_PermissionManager); 58 59 curServiceHost = STR_PermissionManager; 60 result = uriTcp.ToString() + STR_PermissionManager; 59 61 } 60 62 break; 61 63 case Services.SecurityManager: 62 64 if (securityManagerInstances.Length > 0) { 63 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/Security Manager/");65 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/SecurityServer/"); 64 66 serviceHost = new ServiceHost(securityManagerInstances[0].GetType(), uriTcp); 65 67 serviceHost.AddServiceEndpoint(typeof(ISecurityManager), binding, STR_SecurityManager); 66 68 curServiceHost = STR_SecurityManager; 69 result = uriTcp.ToString() + STR_SecurityManager; 67 70 } 68 71 break; … … 77 80 serviceHost.Open(); 78 81 runningServices.Add(curServiceHost, serviceHost); 79 return serviceHost.BaseAddresses[0];82 return result; 80 83 } else 81 84 return null; … … 111 114 112 115 //Start services and record their base address 113 Dictionary<string, Uri> baseAddrDict = new Dictionary<string, Uri>();116 Dictionary<string, String> baseAddrDict = new Dictionary<string, String>(); 114 117 baseAddrDict.Add(STR_PermissionManager, 115 118 StartService(Services.PermissionManager, addresses[index], DEFAULT_PORT_PM));
Note: See TracChangeset
for help on using the changeset viewer.