本文整理汇总了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;
}
}
示例2: SignOut
public void SignOut(IAuthenticationManager authenticationManager)
{
authenticationManager.SignOut();
}
示例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);
}
示例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));
}
示例5: LogOut
public OperationResult<bool> LogOut(IAuthenticationManager authentication)
{
authentication.SignOut();
var result = new OperationResult<bool>(true);
return result;
}
示例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;
}
}