Changeset 1738
- Timestamp:
- 05/05/09 14:55:10 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Security.Contracts/3.2/BusinessObjects/User.cs
r1737 r1738 30 30 [DataContract] 31 31 public class User : PermissionOwner { 32 33 [DataMember] 34 public String Login { get; set; } 35 36 private String password; 37 38 [DataMember] 39 public String Password { 40 get { 41 return this.password; 42 } 43 protected set { 44 this.password = value; 45 } 46 } 47 48 [DataMember] 49 public String MailAddress { get; set; } 50 51 public void SetPlainPassword(String password) { 52 this.password = password; 53 } 54 55 public void SetHashedPassword(String password) { 56 this.password = getMd5Hash(password); 57 } 58 32 59 private static string getMd5Hash(string input) { 33 60 // Create a new instance of the MD5CryptoServiceProvider object. … … 50 77 return sBuilder.ToString(); 51 78 } 52 53 54 [DataMember]55 public String Login { get; set; }56 57 private String password;58 59 [DataMember]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 73 [DataMember]74 public String MailAddress { get; set; }75 79 } 76 80 } -
trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/IPermissionManager.cs
r1737 r1738 10 10 11 11 [OperationContract] 12 [FaultContractAttribute(typeof(CommunicationException))] 12 13 Guid Authenticate(String userName, String password); 13 14 14 15 [OperationContract] 16 [FaultContractAttribute(typeof(CommunicationException))] 15 17 bool CheckPermission(Guid sessionId, Guid permissionId, 16 18 Guid enitityId); 17 19 18 20 [OperationContract] 21 [FaultContractAttribute(typeof(CommunicationException))] 19 22 void EndSession(Guid sessionId); 20 23 -
trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/ISecurityManager.cs
r1729 r1738 11 11 12 12 [OperationContract] 13 [FaultContractAttribute(typeof(CommunicationException))] 13 14 Permission AddPermission(Permission permission); 14 15 15 16 [OperationContract] 17 [FaultContractAttribute(typeof(CommunicationException))] 16 18 bool RemovePermission(Guid permissionId); 17 19 18 20 [OperationContract] 21 [FaultContractAttribute(typeof(CommunicationException))] 19 22 Permission UpdatePermission(Permission permission); 20 23 21 24 [OperationContract] 25 [FaultContractAttribute(typeof(CommunicationException))] 22 26 User AddNewUser(User user); 23 27 24 28 [OperationContract] 29 [FaultContractAttribute(typeof(CommunicationException))] 25 30 bool RemoveUser(Guid userId); 26 31 27 32 [OperationContract] 33 [FaultContractAttribute(typeof(CommunicationException))] 28 34 User UpdateUser(User user); 29 35 30 36 [OperationContract] 37 [FaultContractAttribute(typeof(CommunicationException))] 31 38 ICollection<User> GetAllUsers(); 32 39 33 40 [OperationContract] 41 [FaultContractAttribute(typeof(CommunicationException))] 34 42 User GetUserByName(string name); 35 43 36 44 [OperationContract] 45 [FaultContractAttribute(typeof(CommunicationException))] 37 46 UserGroup AddNewUserGroup(UserGroup group); 38 47 39 48 [OperationContract] 49 [FaultContractAttribute(typeof(CommunicationException))] 40 50 bool RemoveUserGroup(Guid userGroupId); 41 51 42 52 [OperationContract] 53 [FaultContractAttribute(typeof(CommunicationException))] 43 54 UserGroup UpdateUserGroup(UserGroup group); 44 55 45 56 [OperationContract] 57 [FaultContractAttribute(typeof(CommunicationException))] 46 58 ICollection<UserGroup> GetAllUserGroups(); 47 59 48 60 [OperationContract] 61 [FaultContractAttribute(typeof(CommunicationException))] 49 62 UserGroup GetUserGroupByName(string name); 50 63 51 64 [OperationContract] 65 [FaultContractAttribute(typeof(CommunicationException))] 52 66 PermissionOwner UpdatePermissionOwner(PermissionOwner permissionOwner); 53 67 54 68 [OperationContract] 69 [FaultContractAttribute(typeof(CommunicationException))] 55 70 bool AddPermissionOwnerToGroup(Guid userGroupId, Guid permissionOwnerId); 56 71 57 72 [OperationContract] 73 [FaultContractAttribute(typeof(CommunicationException))] 58 74 bool RemovePermissionOwnerFromGroup(Guid userGroupId, Guid permissionOwnerId); 59 75 60 76 [OperationContract] 77 [FaultContractAttribute(typeof(CommunicationException))] 61 78 bool GrantPermission(Guid permissionOwnerId, Guid permissionId, Guid entityId); 62 79 63 80 [OperationContract] 81 [FaultContractAttribute(typeof(CommunicationException))] 64 82 Permission GetPermissionById(Guid permissionId); 65 83 66 84 [OperationContract] 85 [FaultContractAttribute(typeof(CommunicationException))] 67 86 bool RevokePermission(Guid permissionOwnerId, Guid permissionId, Guid entityId); 68 87 } -
trunk/sources/HeuristicLab.Security.Core/3.2/HeuristicLab.Security.Core-3.2.csproj
r1729 r1738 37 37 <Reference Include="System.Core"> 38 38 <RequiredTargetFramework>3.5</RequiredTargetFramework> 39 </Reference> 40 <Reference Include="System.ServiceModel"> 41 <RequiredTargetFramework>3.0</RequiredTargetFramework> 39 42 </Reference> 40 43 <Reference Include="System.Xml.Linq"> -
trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs
r1737 r1738 9 9 using HeuristicLab.PluginInfrastructure; 10 10 using System.Security.Cryptography; 11 using System.ServiceModel; 11 12 12 13 namespace HeuristicLab.Security.Core { … … 60 61 User user = userAdapter.GetByLogin(userName); 61 62 62 if (user != null && 63 if (user != null && 63 64 user.Password.Equals(password)) { 64 65 Guid newSessionId = Guid.NewGuid(); … … 68 69 } else return Guid.Empty; 69 70 } 71 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 70 72 finally { 71 73 if (session != null) … … 100 102 else return false; 101 103 } 104 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 102 105 finally { 103 106 if (session != null) -
trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs
r1729 r1738 17 17 User user = new User(); 18 18 user.Login = "anna"; 19 user. Password = "blubb";19 user.SetHashedPassword("blubb"); 20 20 user.Name = "Anna"; 21 21 user = manager.AddNewUser(user); … … 73 73 User user = new User(); 74 74 user.Login = "anna"; 75 user. Password = "blubb";75 user.SetHashedPassword("blubb"); 76 76 user.Name = "Anna"; 77 77 user = manager.AddNewUser(user); … … 107 107 User user = new User(); 108 108 user.Login = "anna"; 109 user. Password = "blubb";109 user.SetHashedPassword("blubb"); 110 110 user.Name = "Anna"; 111 111 user = manager.AddNewUser(user); … … 113 113 User user2 = new User(); 114 114 user2.Login = "stefan"; 115 user2. Password = "foo";115 user2.SetHashedPassword("foo"); 116 116 user2.Name = "Stefan"; 117 117 -
trunk/sources/HeuristicLab.Security.Core/3.2/SecurityManager.cs
r1729 r1738 8 8 using HeuristicLab.PluginInfrastructure; 9 9 using HeuristicLab.DataAccess.Interfaces; 10 using System.ServiceModel; 10 11 11 12 namespace HeuristicLab.Security.Core { … … 31 32 return user; 32 33 } 34 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 33 35 finally { 34 36 if (session != null) … … 51 53 return user; 52 54 } 55 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 53 56 finally { 54 57 if (session != null) … … 72 75 return false; 73 76 } 77 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 74 78 finally { 75 79 if (session != null) … … 89 93 return userAdapter.GetAll(); 90 94 } 95 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 91 96 finally { 92 97 if (session != null) … … 107 112 return userAdapter.GetByName(name); 108 113 } 114 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 109 115 finally { 110 116 if (session != null) … … 128 134 return userGroup; 129 135 } 136 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 130 137 finally { 131 138 if (session != null) … … 149 156 return userGroup; 150 157 } 158 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 151 159 finally { 152 160 if (session != null) … … 171 179 return false; 172 180 } 181 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 173 182 finally { 174 183 if (session != null) … … 188 197 return userGroupAdapter.GetAll(); 189 198 } 199 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 190 200 finally { 191 201 if (session != null) … … 206 216 return userGroupAdapter.GetByName(name); 207 217 } 218 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 208 219 finally { 209 220 if (session != null) … … 227 238 return permissionOwner; 228 239 } 240 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 229 241 finally { 230 242 if (session != null) … … 258 270 return false; 259 271 } 272 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 260 273 finally { 261 274 if (session != null) … … 290 303 return false; 291 304 } 305 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 292 306 finally { 293 307 if (session != null) … … 310 324 return permissionAdapter.grantPermission(permissionOwnerId, permissionId, entityId); 311 325 } 326 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 312 327 finally { 313 328 if (session != null) … … 328 343 return permissionAdapter.GetById(permissionId); 329 344 } 345 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 330 346 finally { 331 347 if (session != null) … … 348 364 return permissionAdapter.revokePermission(permissionOwnerId, permissionId, entityId); 349 365 } 366 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 350 367 finally { 351 368 if (session != null) … … 366 383 return null; 367 384 } 385 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 368 386 finally { 369 387 if (session != null) … … 383 401 return false; 384 402 } 403 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 385 404 finally { 386 405 if (session != null) … … 401 420 return null; 402 421 } 422 catch (Exception ex) { throw new FaultException("Server: " + ex.Message); } 403 423 finally { 404 424 if (session != null) -
trunk/sources/HeuristicLab.Security.Server/3.2/SecurityServerApplication.cs
r1737 r1738 45 45 46 46 private String StartService(Services svc, IPAddress ipAddress, int port) { 47 binding.MaxReceivedMessageSize = 5000000; 48 binding.SendTimeout = new TimeSpan(0, 0, 0, 0, 20); 47 49 string curServiceHost = ""; 48 50 Uri uriTcp; … … 53 55 switch (svc) { 54 56 case Services.PermissionManager: 55 if ( securityManagerInstances.Length > 0) {57 if (permissionManagerInstances.Length > 0) { 56 58 uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/SecurityServer/"); 57 59 serviceHost = new ServiceHost(permissionManagerInstances[0].GetType(), uriTcp); … … 126 128 StopService(Services.All); 127 129 } 128 } 130 } 129 131 }
Note: See TracChangeset
for help on using the changeset viewer.