コード例 #1
0
        public ActionResult Login(AuthenticateChallengeModel model)
        {
            if (ModelState.IsValid && Authentication.Login(model).IsSuccess)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View(model));
        }
コード例 #2
0
        /// <summary>
        /// <para>ユーザーの認可判定.</para>
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public AuthenticateResultModel Authenticate(AuthenticateChallengeModel model)
        {
            bool result = false;
            var  user   = UserMng.FindAsync(model.UserName, model.Password).Result;

            if (user != null)
            {
                var identity = UserMng.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie).Result;
                HttpContext.Current.GetOwinContext().Authentication.SignIn(identity);
                result = true;
            }
            return(AuthenticateResultModel.Create(model, result));
        }
コード例 #3
0
 public AuthenticateResultModel Login(AuthenticateChallengeModel model)
 {
     return(AuthSvc.Authenticate(model));
 }