public AppUserAuth ValidateUser(ApplicationUser user)
        {
            AppUserAuth     ret      = new AppUserAuth();
            ApplicationUser authUser = null;

            authUser = _securityDatabase.Users
                       .Where(u => u.UserName.ToLower() == user.UserName.ToLower() && u.PasswordHash == user.PasswordHash)
                       .FirstOrDefault();

            if (authUser != null)
            {
                ret = BuildUserAuthObject(authUser);
            }
            return(ret);
        }
        public AppUserAuth BuildUserAuthObject(ApplicationUser authUser)
        {
            AppUserAuth       ret    = new AppUserAuth();
            List <RoleClaims> claims = new List <RoleClaims> ();

            ret.UserName        = authUser.UserName;
            ret.IsAuthenticated = true;
            ret.BearerToken     = new Guid().ToString();

            ret.Claims = GetUserClaims(authUser);

            foreach (RoleClaims claim in claims)
            {
                try {
                    typeof(AppUserAuth).GetProperty(claim.ClaimType).SetValue(ret, Convert.ToBoolean(claim.ClaimValue), null);
                } finally {
                }
            }

            return(ret);
        }