예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="login"></param>
        /// <returns></returns>
        public LogInResult PerformLogInAction(LoginDto login)
        {
            LogInResult result = new LogInResult()
            {
                IsValidUser = false
            };

            Users user = userRepo.GetUserByLoginInformation(login);

            if (user != null)
            {
                // Retrieve claims of current user
                result.ClaimsCollection = Mapper.Map <ICollection <Claim> >(claimRepo.GetListOfClaimsForUser(user.UserId.ToString()));

                // Additionaly add userId as a claim
                result.ClaimsCollection.Add(new Claim(CLAIM_USER_ID, user.UserId.ToString(), ""));

                result.UserId      = user.UserId.ToString();
                result.User        = user;
                result.IsValidUser = true;
            }

            return(result);
        }