/// <summary>
        /// Creates the Umbraco authentication ticket
        /// </summary>
        /// <param name="http"></param>
        /// <param name="user"></param>
        public static void CreateUmbracoAuthTicket(this HttpContextBase http, User user)
        {
            var roles = Roles.Providers.GetBackOfficeRoleProvider().GetRolesForUser(user.Username);
            var userData = new UserData
            {
                Id = user.Id.ToString(),
                Roles = roles,
                SessionTimeout = user.SessionTimeout,
                Username = user.Username,
                RealName = user.Name,
                StartContentNode = user.StartContentHiveId.IsNullValueOrEmpty() ? HiveId.Empty.ToString() : user.StartContentHiveId.ToString(),
                StartMediaNode = user.StartMediaHiveId.IsNullValueOrEmpty() ? HiveId.Empty.ToString() : user.StartMediaHiveId.ToString(),
                AllowedApplications = user.Applications.ToArray()
            };

            http.CreateUmbracoAuthTicket(userData);
        }
        /// <summary>
        /// Creates the umbraco authentication ticket
        /// </summary>
        /// <param name="http"></param>
        /// <param name="userdata"></param>
        internal static void CreateUmbracoAuthTicket(this HttpContextBase http, UserData userdata)
        {
            var userDataString = (new JavaScriptSerializer()).Serialize(userdata);

            CreateAuthTicket(http, userdata.Username, userDataString, userdata.SessionTimeout, userdata.SessionTimeout, "/", UmbracoAuthCookieName);
        }