当前位置: 首页>>代码示例>>C#>>正文


C# IAuthenticationManager.SignOut方法代码示例

本文整理汇总了C#中IAuthenticationManager.SignOut方法的典型用法代码示例。如果您正苦于以下问题:C# IAuthenticationManager.SignOut方法的具体用法?C# IAuthenticationManager.SignOut怎么用?C# IAuthenticationManager.SignOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAuthenticationManager的用法示例。


在下文中一共展示了IAuthenticationManager.SignOut方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginAsync

 //Аутентификация пользователя
 public async Task<string> LoginAsync(LoginUserModel userLogin, IAuthenticationManager authenticationManager)
 {
     CatalogUser user = await _userManager.FindAsync(userLogin.UserName, userLogin.Password);
     if (user == null)
     {
         return "Неверный логин или пароль";
     }
     else if (user.Activated == false)
     {
         return "Ваша учётная запись ещё не активирована администратором.";
     }
     else
     {
         ClaimsIdentity claim = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
         authenticationManager.SignOut();
         authenticationManager.SignIn(new AuthenticationProperties
         {
             IsPersistent = userLogin.RememberMe,
         }, claim);
         return null;
     }
 }
开发者ID:IvanNkl,项目名称:Catalog,代码行数:23,代码来源:UserService.cs

示例2: SignOut

 public void SignOut(IAuthenticationManager authenticationManager)
 {
     authenticationManager.SignOut();
 }
开发者ID:kateEvstratenko,项目名称:groupMvcProject,代码行数:4,代码来源:UserService.cs

示例3: SignInAsync

 private async Task SignInAsync(ApplicationUser user, bool isPersistent, IAuthenticationManager authenticationManager)
 {
     authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
     authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
 }
开发者ID:21428432,项目名称:Basic,代码行数:6,代码来源:LoginBusiness.cs

示例4: SignInAsync

 public static async Task SignInAsync(IAuthenticationManager authManager, ApplicationUserManager userManager,
     User user, bool isPersistent)
 {
     authManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     authManager.SignIn(new AuthenticationProperties {IsPersistent = isPersistent},
         await user.GenerateUserIdentityAsync(userManager));
 }
开发者ID:alin-rautoiu,项目名称:Cart42,代码行数:7,代码来源:ShoppingCartController.cs

示例5: LogOut

 public OperationResult<bool> LogOut(IAuthenticationManager authentication)
 {
     authentication.SignOut();
     var result = new OperationResult<bool>(true);
     return result;
 }
开发者ID:jstadnicki,项目名称:tbi,代码行数:6,代码来源:LoginLogic.cs

示例6: LoginAsync

 public async Task<string> LoginAsync(UserLogin userLogin, IAuthenticationManager authenticationManager)
 {
     SchoolUser user = await _userManager.FindAsync(userLogin.UserName, userLogin.Password);
     if (user == null)
     {
         return "Неверный логин или пароль";
     }
     else
     {
         ClaimsIdentity claim = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
         authenticationManager.SignOut();
         authenticationManager.SignIn(new AuthenticationProperties
         {
             IsPersistent = userLogin.RememberMe,
         }, claim);
         return null;
     }
 }
开发者ID:IvanNkl,项目名称:AutoSchool,代码行数:18,代码来源:RegisterService.cs


注:本文中的IAuthenticationManager.SignOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。