public AjaxResponse LinkAccount(string serializedProfile)
 {
     //Link it
     var profile = new LoginProfile(serializedProfile);
     GetLinker().AddLink(SecurityContext.CurrentAccount.ID.ToString(), profile);
     return RenderControlHtml();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountLink = (AccountLinkControl) LoadControl(AccountLinkControl.Location);
            accountLink.ClientCallback = "loginJoinCallback";
            accountLink.SettingsView = false;
            ThirdPartyList.Controls.Add(accountLink);

            var loginProfile = Request.Url.GetProfile();

            if (loginProfile == null && !IsPostBack || SecurityContext.IsAuthenticated) return;

            try
            {
                if (loginProfile == null)
                {
                    if (string.IsNullOrEmpty(Request["__EVENTARGUMENT"]) || Request["__EVENTTARGET"] != "thirdPartyLogin")
                    {
                        return;
                    }

                    loginProfile = new LoginProfile(Request["__EVENTARGUMENT"]);
                }

                var userInfo = GetUserByThirdParty(loginProfile);
                if (!CoreContext.UserManager.UserExists(userInfo.ID)) return;

                var cookiesKey = SecurityContext.AuthenticateMe(userInfo.ID);
                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                MessageService.Send(HttpContext.Current.Request, MessageAction.LoginSuccessViaSocialAccount);
            }
            catch (System.Security.SecurityException)
            {
                LoginMessage = Resource.InvalidUsernameOrPassword;
                MessageService.Send(HttpContext.Current.Request, loginProfile != null ? loginProfile.EMail : AuditResource.EmailNotSpecified, MessageAction.LoginFailDisabledProfile);
                return;
            }
            catch (Exception exception)
            {
                LoginMessage = exception.Message;
                MessageService.Send(HttpContext.Current.Request, AuditResource.EmailNotSpecified, MessageAction.LoginFail);
                return;
            }

            var refererURL = (string) Session["refererURL"];

            if (String.IsNullOrEmpty(refererURL))
                Response.Redirect(CommonLinkUtility.GetDefault());
            else
            {
                Session["refererURL"] = null;
                Response.Redirect(refererURL);
            }
        }
Exemplo n.º 3
0
 public void AddLink(string obj, LoginProfile profile)
 {
     using (var db = new DbManager(dbid))
     {
         using (var tx = db.BeginTransaction())
         {
             db.ExecuteScalar<int>(
                 new SqlInsert(LinkTable, true)
                     .InColumnValue("id", obj)
                     .InColumnValue("uid", profile.HashId)
                     .InColumnValue("provider", profile.Provider)
                     .InColumnValue("profile", profile.ToSerializedString())
                     .InColumnValue("linked", DateTime.UtcNow)
                 );
             tx.Commit();
         }
     }
 }
 public static LoginProfile GetProfile(this Uri uri)
 {
     var profile = new LoginProfile();
     var queryString = HttpUtility.ParseQueryString(uri.Query);
     if (!string.IsNullOrEmpty(queryString[LoginProfile.QuerySessionParamName]) && HttpContext.Current != null && HttpContext.Current.Session != null)
     {
         return (LoginProfile)HttpContext.Current.Session[queryString[LoginProfile.QuerySessionParamName]];
     }
     if (!string.IsNullOrEmpty(queryString[LoginProfile.QueryParamName]))
     {
         profile.ParseFromUrl(uri);
         return profile;
     }
     if (!string.IsNullOrEmpty(queryString[LoginProfile.QueryCacheParamName]))
     {
         return (LoginProfile)HttpRuntime.Cache.Get(queryString[LoginProfile.QuerySessionParamName]);
     }
     return null;
 }
Exemplo n.º 5
0
 public LoginProfile GetMinimalProfile()
 {
     var profileNew = new LoginProfile();
     profileNew.Provider = Provider;
     profileNew.Id = Id;
     return profileNew;
 }
Exemplo n.º 6
0
        private static LoginProfile ProfileFromYandex(string strProfile)
        {
            var jProfile = JObject.Parse(strProfile);
            if (jProfile == null) throw new Exception("Failed to correctly process the response");

            var profile = new LoginProfile
                {
                    EMail = jProfile.Value<string>("default_email"),
                    Id = jProfile.Value<string>("id"),
                    FirstName = jProfile.Value<string>("first_name"),
                    LastName = jProfile.Value<string>("last_name"),
                    DisplayName = jProfile.Value<string>("display_name"),
                    Gender = jProfile.Value<string>("sex"),

                    Provider = ProviderConstants.Yandex,
                };

            return profile;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/management/confirminviteactivation/js/confirm_invite_activation.js"));

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/management/confirminviteactivation/css/confirm_invite_activation.less"));

            _tenantInfoSettings = SettingsManager.Instance.LoadSettings<TenantInfoSettings>(TenantProvider.CurrentTenantID);

            var uid = Guid.Empty;
            try
            {
                uid = new Guid(Request["uid"]);
            }
            catch
            {
            }

            var email = GetEmailAddress();

            if (_type != ConfirmType.Activation && AccountLinkControl.IsNotEmpty)
            {
                var thrd = (AccountLinkControl) LoadControl(AccountLinkControl.Location);
                thrd.InviteView = true;
                thrd.ClientCallback = "loginJoinCallback";
                thrdParty.Visible = true;
                thrdParty.Controls.Add(thrd);
            }

            Page.Title = HeaderStringHelper.GetPageTitle(Resource.Authorization);

            UserInfo user;
            try
            {
                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);

                user = CoreContext.UserManager.GetUserByEmail(email);
                var usr = CoreContext.UserManager.GetUsers(uid);
                if (usr.ID.Equals(ASC.Core.Users.Constants.LostUser.ID) || usr.ID.Equals(ASC.Core.Configuration.Constants.Guest.ID))
                    usr = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);

                _userAvatar = usr.GetMediumPhotoURL();
                _userName = usr.DisplayUserName(true);
                _userPost = (usr.Title ?? "").HtmlEncode();
            }
            finally
            {
                SecurityContext.Logout();
            }

            if (_type == ConfirmType.LinkInvite || _type == ConfirmType.EmpInvite)
            {
                if (TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers && _employeeType == EmployeeType.User)
                {
                    ShowError(UserControlsCommonResource.TariffUserLimitReason);
                    return;
                }

                if (!user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID))
                {
                    ShowError(CustomNamingPeople.Substitute<Resource>("ErrorEmailAlreadyExists"));
                    return;
                }
            }

            else if (_type == ConfirmType.Activation)
            {
                if (user.IsActive)
                {
                    ShowError(Resource.ErrorConfirmURLError);
                    return;
                }

                if (user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID) || user.Status == EmployeeStatus.Terminated)
                {
                    ShowError(string.Format(Resource.ErrorUserNotFoundByEmail, email));
                    return;
                }
            }

            if (!IsPostBack)
                return;

            var firstName = GetFirstName();
            var lastName = GetLastName();
            var pwd = (Request["pwdInput"] ?? "").Trim();
            var repwd = (Request["repwdInput"] ?? "").Trim();
            LoginProfile thirdPartyProfile;

            //thirdPartyLogin confirmInvite
            if (Request["__EVENTTARGET"] == "thirdPartyLogin")
            {
                var valueRequest = Request["__EVENTARGUMENT"];
                thirdPartyProfile = new LoginProfile(valueRequest);

                if (!string.IsNullOrEmpty(thirdPartyProfile.AuthorizationError))
                {
                    // ignore cancellation
                    if (thirdPartyProfile.AuthorizationError != "Canceled at provider")
                        ShowError(HttpUtility.HtmlEncode(thirdPartyProfile.AuthorizationError));
                    return;
                }

                if (string.IsNullOrEmpty(thirdPartyProfile.EMail))
                {
                    ShowError(HttpUtility.HtmlEncode(Resource.ErrorNotCorrectEmail));
                    return;
                }
            }

            if (Request["__EVENTTARGET"] == "confirmInvite")
            {
                if (String.IsNullOrEmpty(email))
                {
                    _errorMessage = Resource.ErrorEmptyUserEmail;
                    return;
                }

                if (!email.TestEmailRegex())
                {
                    _errorMessage = Resource.ErrorNotCorrectEmail;
                    return;
                }

                if (String.IsNullOrEmpty(firstName))
                {
                    _errorMessage = Resource.ErrorEmptyUserFirstName;
                    return;
                }

                if (String.IsNullOrEmpty(lastName))
                {
                    _errorMessage = Resource.ErrorEmptyUserLastName;
                    return;
                }

                var checkPassResult = CheckPassword(pwd, repwd);
                if (!String.IsNullOrEmpty(checkPassResult))
                {
                    _errorMessage = checkPassResult;
                    return;
                }
            }
            var userID = Guid.Empty;
            try
            {
                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                if (_type == ConfirmType.EmpInvite || _type == ConfirmType.LinkInvite)
                {
                    if (TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers && _employeeType == EmployeeType.User)
                    {
                        ShowError(UserControlsCommonResource.TariffUserLimitReason);
                        return;
                    }

                    UserInfo newUser;
                    if (Request["__EVENTTARGET"] == "confirmInvite")
                    {
                        var fromInviteLink = _type == ConfirmType.LinkInvite;
                        newUser = CreateNewUser(firstName, lastName, email, pwd, _employeeType, fromInviteLink);
                        userID = newUser.ID;
                    }

                    if (Request["__EVENTTARGET"] == "thirdPartyLogin")
                    {
                        if (!String.IsNullOrEmpty(CheckPassword(pwd, repwd)))
                            pwd = UserManagerWrapper.GeneratePassword();
                        var valueRequest = Request["__EVENTARGUMENT"];
                        thirdPartyProfile = new LoginProfile(valueRequest);
                        newUser = CreateNewUser(GetFirstName(thirdPartyProfile), GetLastName(thirdPartyProfile), GetEmailAddress(thirdPartyProfile), pwd, _employeeType, false);
                        userID = newUser.ID;
                        if (!String.IsNullOrEmpty(thirdPartyProfile.Avatar))
                            SaveContactImage(userID, thirdPartyProfile.Avatar);

                        var linker = new AccountLinker("webstudio");
                        linker.AddLink(userID.ToString(), thirdPartyProfile);
                    }
                }
                else if (_type == ConfirmType.Activation)
                {
                    user.ActivationStatus = EmployeeActivationStatus.Activated;
                    user.FirstName = firstName;
                    user.LastName = lastName;
                    CoreContext.UserManager.SaveUserInfo(user);
                    SecurityContext.SetUserPassword(user.ID, pwd);

                    userID = user.ID;

                    //notify
                    if (user.IsVisitor()) { 
                        StudioNotifyService.Instance.GuestInfoAddedAfterInvite(user, pwd);
                    }
                    else
                    {
                        StudioNotifyService.Instance.UserInfoAddedAfterInvite(user, pwd);
                    }
                }
            }
            catch (Exception exception)
            {
                _errorMessage = HttpUtility.HtmlEncode(exception.Message);
                return;
            }
            finally
            {
                SecurityContext.Logout();
            }

            try
            {
                var cookiesKey = SecurityContext.AuthenticateMe(userID.ToString(), pwd);
                CookiesManager.SetCookies(CookiesType.UserID, userID.ToString());
                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                StudioNotifyService.Instance.UserHasJoin();
            }
            catch (Exception exception)
            {
                (Page as confirm).ErrorMessage = HttpUtility.HtmlEncode(exception.Message);
                return;
            }

            user = CoreContext.UserManager.GetUsers(userID);

            UserHelpTourHelper.IsNewUser = true;
            Response.Redirect(user.IsVisitor() ? "~/" : "~/welcome.aspx");
        }
        internal static LoginProfile ProfileFromFacebook(FacebookGraph graph)
        {
            var profile = new LoginProfile
                              {
                                  BirthDay = graph.Birthday,
                                  Link = graph.Link.ToString(),
                                  FirstName = graph.FirstName,
                                  LastName = graph.LastName,
                                  Gender = graph.Gender,
                                  DisplayName = graph.FirstName + graph.LastName,
                                  EMail = graph.Email,
                                  Id = graph.Id.ToString(),
                                  TimeZone = graph.Timezone,
                                  Locale = graph.Locale,
                                  Provider = ProviderConstants.Facebook,
                                  Avatar = string.Format("http://graph.facebook.com/{0}/picture", graph.Id)
                              };

            return profile;
        }
 public static Uri AddProfileSession(this Uri uri, LoginProfile profile, HttpContext context)
 {
     return profile.AppendSessionProfile(uri, context);
 }
Exemplo n.º 10
0
 private void SendJsCallback(HttpContext context, LoginProfile profile)
 {
     //Render a page
     context.Response.ContentType = "text/html";
     context.Response.Write(JsCallbackHelper.GetCallbackPage().Replace("%PROFILE%", profile.ToJson()).Replace("%CALLBACK%", Callback));
 }
        private static LoginProfile ProfileFromGoogle(string googleProfile)
        {
            var jProfile = JObject.Parse(googleProfile);
            if (jProfile == null) return null;

            var emailsArr = jProfile.Value<JArray>("emails");
            if (emailsArr == null) return null;

            var emailsList = emailsArr.ToObject<List<GoogleEmail>>();
            if (emailsList.Count == 0) return null;

            var ind = emailsList.FindIndex(gEmail => gEmail.primary);
            var email = emailsList[ind > -1 ? ind : 0].value;

            var profile = new LoginProfile
                {
                    EMail = email,
                    Id = jProfile.Value<string>("id"),
                    DisplayName = jProfile.Value<string>("displayName"),
                    FirstName = (string)jProfile.SelectToken("name.givenName"),
                    LastName = (string)jProfile.SelectToken("name.familyName"),
                    MiddleName = (string)jProfile.SelectToken("name.middleName"),
                    Link = jProfile.Value<string>("url"),
                    BirthDay = jProfile.Value<string>("birthday"),
                    Gender = jProfile.Value<string>("gender"),
                    Locale = jProfile.Value<string>("language"),
                    TimeZone = jProfile.Value<string>("currentLocation"),
                    Avatar = (string)jProfile.SelectToken("image.url"),

                    Provider = ProviderConstants.Google,
                };

            return profile;
        }
Exemplo n.º 12
0
 private void SendClientData(HttpContext context, LoginProfile profile)
 {
     if (Mode == LoginMode.Redirect)
     {
         RedirectToReturnUrl(context, profile);
     }
     else if (Mode == LoginMode.Popup)
     {
         SendJsCallback(context, profile);
     }
 }
 public static Uri AddProfileCache(this Uri uri, LoginProfile profile)
 {
     return(profile.AppendCacheProfile(uri));
 }
 public static Uri AddProfileSession(this Uri uri, LoginProfile profile, HttpContext context)
 {
     return(profile.AppendSessionProfile(uri, context));
 }
Exemplo n.º 15
0
 internal static LoginProfile CreateFromSerializedString(string serialized)
 {
     var profile = new LoginProfile();
     profile.FromSerializedString(serialized);
     return profile;
 }
 public IEnumerable<String> GetLinkedObjects(LoginProfile profile)
 {
     return _accountLinkers.Values.SelectMany(x => x.GetLinkedObjects(profile));
 }
 public static Uri AddProfileCache(this Uri uri, LoginProfile profile, IMemoryCache memoryCache)
 {
     return(profile.AppendCacheProfile(uri, memoryCache));
 }
 public void AddLink(String hostedRegion, string obj, LoginProfile profile)
 {
     _accountLinkers[GetDatabaseId(hostedRegion)].AddLink(obj, profile);
 }
Exemplo n.º 19
0
        private void RedirectToReturnUrl(HttpContext context, LoginProfile profile)
        {
            var useMinimalProfile = Minimal;
            if (useMinimalProfile)
                profile = profile.GetMinimalProfile(); //Only id and provider

            if (context.Session != null && !useMinimalProfile)
            {
                //Store in session
                context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfileSession(profile, context).ToString(), true);
            }
            else if (HttpRuntime.Cache != null && !useMinimalProfile)
            {
                context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfileCache(profile).ToString(), true);
            }
            else
            {
                context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfile(profile).ToString(), true);
            }
        }
Exemplo n.º 20
0
 public void RemoveLink(string obj, LoginProfile profile)
 {
     RemoveProvider(obj, hashId: profile.HashId);
 }
 public static Uri AddProfileCache(this Uri uri, LoginProfile profile)
 {
     return profile.AppendCacheProfile(uri);
 }
Exemplo n.º 22
0
        public void AddLink(string obj, LoginProfile profile)
        {
            CacheEntry.Reset(obj);

            using (var db = new DbManager(_dbid))
            {
                db.ExecuteScalar<int>(
                    new SqlInsert(LinkTable, true)
                        .InColumnValue("id", obj)
                        .InColumnValue("uid", profile.HashId)
                        .InColumnValue("provider", profile.Provider)
                        .InColumnValue("profile", profile.ToSerializedString())
                        .InColumnValue("linked", DateTime.UtcNow)
                    );
            }
        }
Exemplo n.º 23
0
        private static LoginProfile ProfileFromVK(string strProfile)
        {
            var jProfile = JObject.Parse(strProfile);
            if (jProfile == null) throw new Exception("Failed to correctly process the response");

            var profileJson = jProfile.Value<JArray>("response");
            if (profileJson == null) throw new Exception("Failed to correctly process the response");

            var vkProfiles = profileJson.ToObject<List<VKProfile>>();
            if (vkProfiles.Count == 0) throw new Exception("Failed to correctly process the response");

            var profile = new LoginProfile
                {
                    //EMail = email,
                    Id = vkProfiles[0].uid,
                    FirstName = vkProfiles[0].first_name,
                    LastName = vkProfiles[0].last_name,
                    BirthDay = vkProfiles[0].bdate,

                    Provider = ProviderConstants.VK,
                };

            return profile;
        }
Exemplo n.º 24
0
 public void RemoveLink(string obj, LoginProfile profile)
 {
     using (var db = new DbManager(dbid))
     {
         using (var tx = db.BeginTransaction())
         {
             db.ExecuteScalar<int>(
                 new SqlDelete(LinkTable)
                     .Where("id", obj)
                     .Where("uid", profile.HashId)
                 );
             tx.Commit();
         }
     }
 }
 private string GetLastName(LoginProfile account)
 {
     var value = GetLastName();
     return String.IsNullOrEmpty(value) ? account.LastName : value;
 }
Exemplo n.º 26
0
 public IEnumerable<string> GetLinkedObjects(LoginProfile profile)
 {
     //Retrieve by uinque id
     return GetLinkedObjectsByHashId(profile.HashId);
 }
 private string GetEmailAddress(LoginProfile account)
 {
     var value = GetEmailAddress();
     return String.IsNullOrEmpty(value) ? account.EMail : value;
 }
Exemplo n.º 28
0
 internal static LoginProfile ProfileFromTwitter(XDocument info)
 {
     XPathNavigator nav = info.CreateNavigator();
     var profile = new LoginProfile
                       {
                           Name = nav.SelectNodeValue("//screen_name"),
                           DisplayName = nav.SelectNodeValue("//name"),
                           Avatar = nav.SelectNodeValue("//profile_image_url"),
                           TimeZone = nav.SelectNodeValue("//time_zone"),
                           Locale = nav.SelectNodeValue("//lang"),
                           Id = nav.SelectNodeValue("//id"),
                           Link = nav.SelectNodeValue("//url"),
                           Provider = ProviderConstants.Twitter
                       };
     return profile;
 }
Exemplo n.º 29
0
        internal static LoginProfile ProfileFromFacebook(string facebookProfile)
        {
            var jProfile = JObject.Parse(facebookProfile);
            if (jProfile == null) throw new Exception("Failed to correctly process the response");

            var profile = new LoginProfile
                              {
                                  BirthDay = jProfile.Value<string>("birthday"),
                                  Link = jProfile.Value<string>("link"),
                                  FirstName = jProfile.Value<string>("first_name"),
                                  LastName = jProfile.Value<string>("last_name"),
                                  Gender = jProfile.Value<string>("gender"),
                                  EMail = jProfile.Value<string>("email"),
                                  Id = jProfile.Value<string>("id"),
                                  TimeZone = jProfile.Value<string>("timezone"),
                                  Locale = jProfile.Value<string>("locale"),
                                  Provider = ProviderConstants.Facebook,
                                  Avatar = string.Format("http://graph.facebook.com/{0}/picture?type=large", jProfile.Value<string>("id"))
                              };

            return profile;
        }
        public AjaxResponse LinkAccount(string serializedProfile)
        {
            //Link it
            var profile = new LoginProfile(serializedProfile);

            if (string.IsNullOrEmpty(profile.AuthorizationError))
            {
                GetLinker().AddLink(SecurityContext.CurrentAccount.ID.ToString(), profile);
                MessageService.Send(HttpContext.Current.Request, MessageAction.UserLinkedSocialAccount, GetMeaningfulProviderName(profile.Provider));
            }
            else
            {
                // ignore cancellation
                if (profile.AuthorizationError != "Canceled at provider")
                {
                    throw new Exception(profile.AuthorizationError);
                }
            }
            return RenderControlHtml();
        }
Exemplo n.º 31
0
 internal static LoginProfile FromError(Exception e)
 {
     var profile = new LoginProfile {AuthorizationError = e.Message};
     return profile;
 }
Exemplo n.º 32
0
 private void SendClientData(HttpContext context, LoginProfile profile)
 {
     switch (Mode)
     {
         case LoginMode.Redirect:
             RedirectToReturnUrl(context, profile);
             break;
         case LoginMode.Popup:
             SendJsCallback(context, profile);
             break;
     }
 }
Exemplo n.º 33
0
 internal static LoginProfile ProfileFromOpenId(ClaimsResponse spprofile, FetchResponse fetchprofile, string claimedId, string realmUrlString)
 {
     var profile = new LoginProfile
     {
         Link = claimedId,
         Id = claimedId,
         Provider = ProviderConstants.OpenId,
     };
     if (spprofile != null)
     {
         //Fill
         profile.BirthDay = spprofile.BirthDateRaw;
         profile.DisplayName = spprofile.FullName;
         profile.EMail = spprofile.Email;
         profile.Name = spprofile.Nickname;
         profile.Gender = spprofile.Gender.HasValue ? spprofile.Gender.Value.ToString() : "";
         profile.TimeZone = spprofile.TimeZone;
         profile.Locale = spprofile.Language;
     }
     if (fetchprofile != null)
     {
         profile.Name = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.Alias);
         profile.LastName = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.Last);
         profile.FirstName = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.First);
         profile.DisplayName = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.FullName);
         profile.MiddleName = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.Middle);
         profile.Salutation = fetchprofile.GetAttributeValue(WellKnownAttributes.Name.Prefix);
         profile.Avatar = fetchprofile.GetAttributeValue(WellKnownAttributes.Media.Images.Default);
         profile.EMail = fetchprofile.GetAttributeValue(WellKnownAttributes.Contact.Email);
         profile.Gender = fetchprofile.GetAttributeValue(WellKnownAttributes.Person.Gender);
         profile.BirthDay = fetchprofile.GetAttributeValue(WellKnownAttributes.BirthDate.WholeBirthDate);
     }
     profile.RealmUrl = realmUrlString;
     return profile;
 }
 public static Uri AddProfileSession(this Uri uri, LoginProfile profile, Microsoft.AspNetCore.Http.HttpContext context)
 {
     return(profile.AppendSessionProfile(uri, context));
 }