Changeset 1738


Ignore:
Timestamp:
05/05/09 14:55:10 (12 years ago)
Author:
asimon
Message:

error correction (ticket #537)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Security.Contracts/3.2/BusinessObjects/User.cs

    r1737 r1738  
    3030  [DataContract]
    3131  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
    3259    private static string getMd5Hash(string input) {
    3360      // Create a new instance of the MD5CryptoServiceProvider object.
     
    5077      return sBuilder.ToString();
    5178    }
    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; }
    7579  }
    7680}
  • trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/IPermissionManager.cs

    r1737 r1738  
    1010
    1111    [OperationContract]
     12    [FaultContractAttribute(typeof(CommunicationException))]
    1213    Guid Authenticate(String userName, String password);
    1314
    1415    [OperationContract]
     16    [FaultContractAttribute(typeof(CommunicationException))]
    1517    bool CheckPermission(Guid sessionId, Guid permissionId,
    1618      Guid enitityId);
    1719
    1820    [OperationContract]
     21    [FaultContractAttribute(typeof(CommunicationException))]
    1922    void EndSession(Guid sessionId);
    2023
  • trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/ISecurityManager.cs

    r1729 r1738  
    1111
    1212    [OperationContract]
     13    [FaultContractAttribute(typeof(CommunicationException))]
    1314    Permission AddPermission(Permission permission);
    1415
    1516    [OperationContract]
     17    [FaultContractAttribute(typeof(CommunicationException))]
    1618    bool RemovePermission(Guid permissionId);
    1719
    1820    [OperationContract]
     21    [FaultContractAttribute(typeof(CommunicationException))]
    1922    Permission UpdatePermission(Permission permission);
    2023
    2124    [OperationContract]
     25    [FaultContractAttribute(typeof(CommunicationException))]
    2226    User AddNewUser(User user);
    2327
    2428    [OperationContract]
     29    [FaultContractAttribute(typeof(CommunicationException))]
    2530    bool RemoveUser(Guid userId);
    2631
    2732    [OperationContract]
     33    [FaultContractAttribute(typeof(CommunicationException))]
    2834    User UpdateUser(User user);
    2935
    3036    [OperationContract]
     37    [FaultContractAttribute(typeof(CommunicationException))]
    3138    ICollection<User> GetAllUsers();
    3239
    3340    [OperationContract]
     41    [FaultContractAttribute(typeof(CommunicationException))]
    3442    User GetUserByName(string name);
    3543
    3644    [OperationContract]
     45    [FaultContractAttribute(typeof(CommunicationException))]
    3746    UserGroup AddNewUserGroup(UserGroup group);
    3847
    3948    [OperationContract]
     49    [FaultContractAttribute(typeof(CommunicationException))]
    4050    bool RemoveUserGroup(Guid userGroupId);
    4151
    4252    [OperationContract]
     53    [FaultContractAttribute(typeof(CommunicationException))]
    4354    UserGroup UpdateUserGroup(UserGroup group);
    4455
    4556    [OperationContract]
     57    [FaultContractAttribute(typeof(CommunicationException))]
    4658    ICollection<UserGroup> GetAllUserGroups();
    4759
    4860    [OperationContract]
     61    [FaultContractAttribute(typeof(CommunicationException))]
    4962    UserGroup GetUserGroupByName(string name);
    5063
    5164    [OperationContract]
     65    [FaultContractAttribute(typeof(CommunicationException))]
    5266    PermissionOwner UpdatePermissionOwner(PermissionOwner permissionOwner);
    5367
    5468    [OperationContract]
     69    [FaultContractAttribute(typeof(CommunicationException))]
    5570    bool AddPermissionOwnerToGroup(Guid userGroupId, Guid permissionOwnerId);
    5671
    5772    [OperationContract]
     73    [FaultContractAttribute(typeof(CommunicationException))]
    5874    bool RemovePermissionOwnerFromGroup(Guid userGroupId, Guid permissionOwnerId);
    5975
    6076    [OperationContract]
     77    [FaultContractAttribute(typeof(CommunicationException))]
    6178    bool GrantPermission(Guid permissionOwnerId, Guid permissionId, Guid entityId);
    6279
    6380    [OperationContract]
     81    [FaultContractAttribute(typeof(CommunicationException))]
    6482    Permission GetPermissionById(Guid permissionId);
    6583
    6684    [OperationContract]
     85    [FaultContractAttribute(typeof(CommunicationException))]
    6786    bool RevokePermission(Guid permissionOwnerId, Guid permissionId, Guid entityId);
    6887  }
  • trunk/sources/HeuristicLab.Security.Core/3.2/HeuristicLab.Security.Core-3.2.csproj

    r1729 r1738  
    3737    <Reference Include="System.Core">
    3838      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     39    </Reference>
     40    <Reference Include="System.ServiceModel">
     41      <RequiredTargetFramework>3.0</RequiredTargetFramework>
    3942    </Reference>
    4043    <Reference Include="System.Xml.Linq">
  • trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs

    r1737 r1738  
    99using HeuristicLab.PluginInfrastructure;
    1010using System.Security.Cryptography;
     11using System.ServiceModel;
    1112
    1213namespace HeuristicLab.Security.Core {
     
    6061        User user = userAdapter.GetByLogin(userName);
    6162
    62         if (user != null && 
     63        if (user != null &&
    6364            user.Password.Equals(password)) {
    6465          Guid newSessionId = Guid.NewGuid();
     
    6869        } else return Guid.Empty;
    6970      }
     71      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    7072      finally {
    7173        if (session != null)
     
    100102          else return false;
    101103        }
     104        catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    102105        finally {
    103106          if (session != null)
  • trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs

    r1729 r1738  
    1717        User user = new User();
    1818        user.Login = "anna";
    19         user.Password = "blubb";
     19        user.SetHashedPassword("blubb");
    2020        user.Name = "Anna";
    2121        user = manager.AddNewUser(user);
     
    7373        User user = new User();
    7474        user.Login = "anna";
    75         user.Password = "blubb";
     75        user.SetHashedPassword("blubb");
    7676        user.Name = "Anna";
    7777        user = manager.AddNewUser(user);
     
    107107        User user = new User();
    108108        user.Login = "anna";
    109         user.Password = "blubb";
     109        user.SetHashedPassword("blubb");
    110110        user.Name = "Anna";
    111111        user = manager.AddNewUser(user);
     
    113113        User user2 = new User();
    114114        user2.Login = "stefan";
    115         user2.Password = "foo";
     115        user2.SetHashedPassword("foo");
    116116        user2.Name = "Stefan";
    117117
  • trunk/sources/HeuristicLab.Security.Core/3.2/SecurityManager.cs

    r1729 r1738  
    88using HeuristicLab.PluginInfrastructure;
    99using HeuristicLab.DataAccess.Interfaces;
     10using System.ServiceModel;
    1011
    1112namespace HeuristicLab.Security.Core {
     
    3132        return user;
    3233      }
     34      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    3335      finally {
    3436        if (session != null)
     
    5153        return user;
    5254      }
     55      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    5356      finally {
    5457        if (session != null)
     
    7275        return false;
    7376      }
     77      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    7478      finally {
    7579        if (session != null)
     
    8993        return userAdapter.GetAll();
    9094      }
     95      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    9196      finally {
    9297        if (session != null)
     
    107112        return userAdapter.GetByName(name);
    108113      }
     114      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    109115      finally {
    110116        if (session != null)
     
    128134        return userGroup;
    129135      }
     136      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    130137      finally {
    131138        if (session != null)
     
    149156        return userGroup;
    150157      }
     158      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    151159      finally {
    152160        if (session != null)
     
    171179        return false;
    172180      }
     181      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    173182      finally {
    174183        if (session != null)
     
    188197        return userGroupAdapter.GetAll();
    189198       }
     199      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    190200      finally {
    191201        if (session != null)
     
    206216        return userGroupAdapter.GetByName(name);
    207217      }
     218      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    208219      finally {
    209220        if (session != null)
     
    227238        return permissionOwner;
    228239      }
     240      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    229241      finally {
    230242        if (session != null)
     
    258270        return false;
    259271      }
     272      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    260273      finally {
    261274        if (session != null)
     
    290303        return false;
    291304      }
     305      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    292306      finally {
    293307        if (session != null)
     
    310324        return permissionAdapter.grantPermission(permissionOwnerId, permissionId, entityId);
    311325      }
     326      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    312327      finally {
    313328        if (session != null)
     
    328343        return permissionAdapter.GetById(permissionId);
    329344      }
     345      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    330346      finally {
    331347        if (session != null)
     
    348364        return permissionAdapter.revokePermission(permissionOwnerId, permissionId, entityId);
    349365      }
     366      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    350367      finally {
    351368        if (session != null)
     
    366383          return null;
    367384      }
     385      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    368386      finally {
    369387        if (session != null)
     
    383401          return false;
    384402      }
     403      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    385404      finally {
    386405        if (session != null)
     
    401420          return null;
    402421      }
     422      catch (Exception ex) { throw new FaultException("Server: " + ex.Message); }
    403423      finally {
    404424        if (session != null)
  • trunk/sources/HeuristicLab.Security.Server/3.2/SecurityServerApplication.cs

    r1737 r1738  
    4545
    4646    private String StartService(Services svc, IPAddress ipAddress, int port) {
     47      binding.MaxReceivedMessageSize = 5000000;
     48      binding.SendTimeout = new TimeSpan(0, 0, 0, 0, 20);
    4749      string curServiceHost = "";
    4850      Uri uriTcp;
     
    5355      switch (svc) {
    5456        case Services.PermissionManager:
    55           if (securityManagerInstances.Length > 0) {
     57          if (permissionManagerInstances.Length > 0) {
    5658            uriTcp = new Uri("net.tcp://" + ipAddress + ":" + port + "/SecurityServer/");
    5759            serviceHost = new ServiceHost(permissionManagerInstances[0].GetType(), uriTcp);
     
    126128      StopService(Services.All);
    127129    }
    128   }
     130  }                                                                                     
    129131}
Note: See TracChangeset for help on using the changeset viewer.