How to integrate between Cute Live Support and Sharepoint using AD Users Authentications

Last post 12-19-2011, 6:04 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  12-17-2011, 12:10 PM 72063

    How to integrate between Cute Live Support and Sharepoint using AD Users Authentications

    How to integrate between Cute Live Support and Sharepoint using AD Users Authentications without having to add users from manually
  •  12-19-2011, 6:04 AM 72074 in reply to 72063

    Re: How to integrate between Cute Live Support and Sharepoint using AD Users Authentications

    Hi salah,
     
    Please refer to http://www.cutesoft.net/live-support/Developer-Guide/scr/DeploymentIntegration.htm, it shows you how to integrate with your own membership system.
     
    The chat provider class belows should help, I created it by the sharepoint API.
     
    public class SharePointProvider : ChatProvider
        {
            public string GetCurrentSiteURL()
            {
                return "http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;

            }
            public override string GetConnectionString()
            {
                string connectonString = "Server=(local);integrated security=true;database=sharepoint";
                return connectonString;
            }
            public override string FindUserLoginName(string nickName)
            {

                string loginName = null; ;
                using (SPSite mSite = new SPSite(GetCurrentSiteURL()))
                {
                    SPWeb rootWeb = mSite.RootWeb;
                    for (int i = 0; i < rootWeb.AllUsers.Count; i++)
                    {
                        if (nickName == rootWeb.AllUsers[i].LoginName)
                        {
                            loginName = rootWeb.AllUsers[i].LoginName;
                        }
                    }
                }
                return loginName;

            }
            public override AppChatIdentity GetLogonIdentity()
            {
                using (SPSite mSite = new SPSite(GetCurrentSiteURL()))
                {
                    SPWeb rootWeb = mSite.RootWeb;
                    SPUser mSPUser = rootWeb.CurrentUser;
                    string loginName = mSPUser.LoginName;
                    string nickName = mSPUser.LoginName;
                    //string name = mSPUser.LoginName.Remove(0, mSPUser.LoginName.IndexOf("\\") + 1);

                    return new AppChatIdentity(nickName, false, ToUserId(loginName), HttpContext.Current.Request.UserHostAddress);

                }
            }
            public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
            {
                using (SPSite mSite = new SPSite(GetCurrentSiteURL()))
                {
                    SPWeb rootWeb = mSite.RootWeb;

                    for (int i = 0; i < rootWeb.AllUsers.Count; i++)
                    {
                        if (loginName == rootWeb.AllUsers[i].LoginName)
                        {
                            nickName = rootWeb.AllUsers[i].LoginName;
                            isAdmin = rootWeb.AllUsers[i].IsSiteAdmin;
                            return true;
                        }
                    }
                }
                return false;
            }
            public override bool ValidateUser(string loginName, string password)
            {

                //if (!Membership.ValidateUser(loginName, password))
                //{
                //    return false;
                //}
                //System.Web.Security.FormsAuthentication.SetAuthCookie(loginName, false, "/");

                return true;
            }

        }
     
    Regards,
     
    Ken
View as RSS news feed in XML