Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4321


Ignore:
Timestamp:
08/26/10 04:23:35 (14 years ago)
Author:
swagner
Message:

Worked on OKB user authentication (#1167)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj

    r4313 r4321  
    115115    <Reference Include="System.Runtime.Serialization" />
    116116    <Reference Include="System.ServiceModel" />
     117    <Reference Include="System.Web" />
     118    <Reference Include="System.Web.ApplicationServices" />
    117119    <Reference Include="System.Xml" />
    118120    <Reference Include="System.Xml.Linq" />
  • trunk/sources/HeuristicLab.Services.OKB/3.3/RunnerService.cs

    r4313 r4321  
    2525using System.Linq;
    2626using System.ServiceModel;
     27using System.Web.Security;
    2728using HeuristicLab.Services.OKB.DataAccess;
    2829using log4net;
     
    307308    /// </returns>
    308309    public bool Login(string clientname) {
    309       string username = ServiceSecurityContext.Current.PrimaryIdentity.Name;
    310 
    311       Log("Authenticating {0}@{1}", username, clientname);
    312       if (string.IsNullOrEmpty(username) ||
     310      MembershipUser user = Membership.GetUser();
     311
     312      Log("Authenticating {0}@{1}", user.UserName, clientname);
     313      if (user == null ||
    313314          string.IsNullOrEmpty(clientname) ||
    314315          ServiceSecurityContext.Current.IsAnonymous) {
     
    317318      }
    318319      using (OKBDataContext okb = new OKBDataContext()) {
    319         currentUser = okb.Users.SingleOrDefault(u => u.Name == username);
     320        currentUser = okb.Users.SingleOrDefault(u => u.Id == (Guid)user.ProviderUserKey);
    320321        currentClient = okb.Clients.SingleOrDefault(c => c.Name == clientname);
    321322        if (currentUser == null) {
    322           currentUser = new User() { Name = username, Id = Guid.NewGuid() };
     323          currentUser = new User() { Name = user.UserName, Id = (Guid)user.ProviderUserKey };
    323324          okb.Users.InsertOnSubmit(currentUser);
    324325          okb.SubmitChanges();
Note: See TracChangeset for help on using the changeset viewer.