/// <summary> /// The concrete method that authenticate a user request /// </summary> /// <param name="request">holding the username, account an the password</param> /// <returns>Object AuthenticateResponse</returns> public AuthenticateResponse Authenticate(AuthenticateRequest request) { //Building the WebService request //First Step Request by Account >> Defining Header AuthenticateResponse response = new AuthenticateResponse(); Dictionary <string, string> headers = SessionHelper.GetAuthorizationHeadersForUser(); RecordWebServiceResponse <UserInfo> userRecord = childRepo.Authenticate(headers, request.Parameters); response = CreateServiceResponse <AuthenticateResponse>(userRecord); if (userRecord == null) { response.Success = false; response.Message = "RequestError"; //This message have to be read from resource, it indicate that there was a problem in the connection. return(response); } if (userRecord.record == null) { response.Success = false; response.Message = "InvalidCredentials"; return(response); } //authentication Valid, set the session then return the response back SessionHelper.Set("UserId", userRecord.record.recordId); SessionHelper.Set("key", SessionHelper.GetToken(SessionHelper.Get("AccountId").ToString(), userRecord.record.recordId)); response.User = userRecord.record; response.Success = true; return(response); }