public bool ValidateUser(string username, string password)
        {
            if (username.Contains("@"))
            {
                using (var context = new PortalEntities())
                {
                    var user = context.User.FirstOrDefault(p => p.Mail == username);

                    if (user == null)
                    {
                        return false;
                    }

                    if (user.PasswordHash == null || user.PasswordSalt == null)
                    {
                        return false;
                    }

                    var pwdManager = new PasswordManagerHelper();

                    var passwordSalt = UtilityHelper.GetString(user.PasswordSalt);
                    var passwordHash = UtilityHelper.GetString(user.PasswordHash);

                    var result = pwdManager.IsPasswordMatch(password, passwordSalt, passwordHash);

                    return result;
                }
            }

            return Membership.ValidateUser(username, password);
        }
        public IEnumerable<Claim> GetClaims(ClaimsPrincipal principal, TokenService.RequestDetails requestDetails)
        {
            var username = principal.Identity.Name;
            var claims = new List<Claim>(from c in principal.Claims select c);

            if (!String.IsNullOrEmpty(username))
            {
                using (var context = new PortalEntities())
                {
                    var user = context.User.FirstOrDefault(p => p.Mail == username);

                    if (user != null)
                    {
                        claims.Add(new Claim("IsAdmin", user.IsAdmin.ToString()));
                    }
                }

                claims.Add(new Claim(ClaimTypes.Email, username));
            }

            return claims;
        }