コード例 #1
0
ファイル: AccountController.cs プロジェクト: uc-dgt/remotelab
        public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {   
                if (Auth.Authenticate(model.UserName, model.Password) )
                {
                    // Build the set of claims for the authenticated user for the various Pools & application administrator
                    var ClaimsUtil = new ClaimsUtility(Auth, await this.Svc.GetPoolsAsync(), Properties.Settings.Default.AdministratorADGroup);                   
                    var identity = ClaimsUtil.BuildClaimsIdentityForUser(model.UserName);
                    await SignInAsync(identity, false);
                    return RedirectToLocal(returnUrl);

                }
                else
                {
                    ModelState.AddModelError("", Properties.Resources.InvalidUserNameOrPassword);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: uc-dgt/remotelab
 public async Task<ActionResult> RolesCheck(FormCollection form)
 {
     var UserName = (String)form["UserName"];
     var pools = await this.Svc.GetPoolsAsync();
     var ClaimsUtil = new ClaimsUtility(Auth, await this.Svc.GetPoolsAsync(), Properties.Settings.Default.AdministratorADGroup);
     var identity = ClaimsUtil.BuildClaimsIdentityForUser(UserName);
     ViewBag.User = new ClaimsPrincipal(identity);
     return View("Roles",pools);
 }