5 instantiations of SignInResult
Microsoft.Extensions.Identity.Core (5)
SignInResult.cs (5)
11
private static readonly SignInResult _success = new
SignInResult
{ Succeeded = true };
12
private static readonly SignInResult _failed = new
SignInResult
();
13
private static readonly SignInResult _lockedOut = new
SignInResult
{ IsLockedOut = true };
14
private static readonly SignInResult _notAllowed = new
SignInResult
{ IsNotAllowed = true };
15
private static readonly SignInResult _twoFactorRequired = new
SignInResult
{ RequiresTwoFactor = true };
141 references to SignInResult
Microsoft.AspNetCore.Identity (71)
IdentityApiEndpointRouteBuilderExtensions.cs (1)
99
var
result = await signInManager.PasswordSignInAsync(login.Email, login.Password, isPersistent, lockoutOnFailure: true);
SignInManager.cs (66)
179
var
signInResult = success ?
SignInResult
.Success :
SignInResult
.Failed;
393
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
395
public virtual async Task<
SignInResult
> PasswordSignInAsync(TUser user, string password,
403
var
attempt = await CheckPasswordSignInAsync(user, password, lockoutOnFailure);
404
var
result = attempt.Succeeded
426
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
428
public virtual async Task<
SignInResult
> PasswordSignInAsync(string userName, string password,
435
_metrics?.AuthenticateSignIn(typeof(TUser).FullName!, AuthenticationScheme,
SignInResult
.Failed, SignInType.Password, isPersistent, startTimestamp);
436
return
SignInResult
.Failed;
448
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
450
public virtual async Task<
SignInResult
> CheckPasswordSignInAsync(TUser user, string password, bool lockoutOnFailure)
456
var
result = await CheckPasswordSignInCoreAsync(user, password, lockoutOnFailure);
468
private async Task<
SignInResult
> CheckPasswordSignInCoreAsync(TUser user, string password, bool lockoutOnFailure)
470
var
error = await PreSignInCheck(user);
488
return
SignInResult
.Failed;
492
return
SignInResult
.Success;
503
return
SignInResult
.Failed;
511
return
SignInResult
.Failed;
639
/// The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
642
public virtual async Task<
SignInResult
> PasskeySignInAsync(string credentialJson)
647
var
result = await PasskeySignInCoreAsync(credentialJson);
659
private async Task<
SignInResult
> PasskeySignInCoreAsync(string credentialJson)
666
return
SignInResult
.Failed;
674
return
SignInResult
.Failed;
795
public virtual async Task<
SignInResult
> TwoFactorRecoveryCodeSignInAsync(string recoveryCode)
800
var
result = await TwoFactorRecoveryCodeSignInCoreAsync(recoveryCode);
812
private async Task<
SignInResult
> TwoFactorRecoveryCodeSignInCoreAsync(string recoveryCode)
817
return
SignInResult
.Failed;
827
return
SignInResult
.Failed;
830
private async Task<
SignInResult
> DoTwoFactorSignInAsync(TUser user, TwoFactorAuthenticationInfo twoFactorInfo, bool isPersistent, bool rememberClient)
838
return
SignInResult
.Failed;
865
return
SignInResult
.Success;
875
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
877
public virtual async Task<
SignInResult
> TwoFactorAuthenticatorSignInAsync(string code, bool isPersistent, bool rememberClient)
882
var
result = await TwoFactorAuthenticatorSignInCoreAsync(code, isPersistent, rememberClient);
894
private async Task<
SignInResult
> TwoFactorAuthenticatorSignInCoreAsync(string code, bool isPersistent, bool rememberClient)
899
return
SignInResult
.Failed;
903
var
error = await PreSignInCheck(user);
921
return
SignInResult
.Failed;
929
return
SignInResult
.Failed;
940
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
942
public virtual async Task<
SignInResult
> TwoFactorSignInAsync(string provider, string code, bool isPersistent, bool rememberClient)
947
var
result = await TwoFactorSignInCoreAsync(provider, code, isPersistent, rememberClient);
959
private async Task<
SignInResult
> TwoFactorSignInCoreAsync(string provider, string code, bool isPersistent, bool rememberClient)
964
return
SignInResult
.Failed;
968
var
error = await PreSignInCheck(user);
985
return
SignInResult
.Failed;
993
return
SignInResult
.Failed;
1018
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
1020
public virtual Task<
SignInResult
> ExternalLoginSignInAsync(string loginProvider, string providerKey, bool isPersistent)
1030
/// <returns>The task object representing the asynchronous operation containing the <see cref="
SignInResult
"/>
1032
public virtual async Task<
SignInResult
> ExternalLoginSignInAsync(string loginProvider, string providerKey, bool isPersistent, bool bypassTwoFactor)
1037
var
result = await ExternalLoginSignInCoreAsync(loginProvider, providerKey, isPersistent, bypassTwoFactor);
1049
private async Task<
SignInResult
> ExternalLoginSignInCoreAsync(string loginProvider, string providerKey, bool isPersistent, bool bypassTwoFactor)
1054
return
SignInResult
.Failed;
1057
var
error = await PreSignInCheck(user);
1212
/// <returns>Returns a <see cref="
SignInResult
"/></returns>
1213
protected virtual async Task<
SignInResult
> SignInOrTwoFactorAsync(TUser user, bool isPersistent, string? loginProvider = null, bool bypassTwoFactor = false)
1234
return
SignInResult
.TwoFactorRequired;
1250
return
SignInResult
.Success;
1300
protected virtual Task<
SignInResult
> LockedOut(TUser user)
1303
return Task.FromResult(
SignInResult
.LockedOut);
1311
protected virtual async Task<
SignInResult
?> PreSignInCheck(TUser user)
1315
return
SignInResult
.NotAllowed;
SignInManagerMetrics.cs (4)
66
internal void CheckPasswordSignIn(string userType,
SignInResult
? result, Exception? exception = null)
83
internal void AuthenticateSignIn(string userType, string authenticationScheme,
SignInResult
? result, SignInType signInType, bool? isPersistent, long startTimestamp, Exception? exception = null)
186
private static void AddSignInResult(ref TagList tags,
SignInResult
? result)
216
private static string GetSignInResult(
SignInResult
result)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
ControllerTest.cs (1)
53
var
result = await signInManager.PasswordSignInAsync(user, password, isPersistent, false);
FunctionalTest.cs (1)
338
var
result = await signInManager.PasswordSignInAsync("hao", TestPassword, isPersistent, false);
Microsoft.AspNetCore.Identity.Test (38)
SignInManagerTest.cs (38)
62
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-bogus1", false, false);
106
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-bogus1", false);
179
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", isPersistent, false);
203
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", false, false);
228
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", false, false);
274
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-1a", false);
298
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-1a", false);
335
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", false, false);
384
var
result = await helper.ExternalLoginSignInAsync(loginProvider, providerKey, isPersistent: false, bypassTwoFactor: bypass);
462
var
signInResult = await helper.PasskeySignInAsync(credentialJson: "<some-passkey>");
467
Assert.Same(
SignInResult
.Success, signInResult);
573
var
result = await helper.TwoFactorAuthenticatorSignInAsync(code, isPersistent, rememberClient);
606
var
result = await helper.TwoFactorAuthenticatorSignInAsync(code, isPersistent: false, rememberClient: false);
645
var
result = await helper.TwoFactorAuthenticatorSignInAsync(code, isPersistent: false, rememberClient: false);
735
var
result = await helper.TwoFactorRecoveryCodeSignInAsync(bypassCode);
768
var
result = await helper.ExternalLoginSignInAsync(loginProvider, providerKey, isPersistent);
999
var
result = await helper.TwoFactorSignInAsync(provider, code, isPersistent, rememberClient);
1034
var
result = await helper.TwoFactorSignInAsync(provider, code, isPersistent: false, rememberClient: false);
1135
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", isPersistent, false);
1222
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-bogus1", false, false);
1223
var
checkResult = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-bogus1", false);
1253
var
result = await helper.PasswordSignInAsync("unknown-username", "[PLACEHOLDER]-bogus1", false, false);
1280
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-bogus1", false, true);
1307
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-bogus1", true);
1341
var
result = await helper.PasswordSignInAsync(user, "[PLACEHOLDER]-1a", false, false);
1396
var
result = await helper.PasswordSignInAsync(user, "[PLACEHOLDER]-1a", false, false);
1537
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-1a", false);
1540
Assert.Same(
SignInResult
.Failed, result);
1562
var
result = await helper.PasswordSignInAsync(user.UserName, "[PLACEHOLDER]-1a", false, false);
1592
var
result = await helper.TwoFactorSignInAsync(provider, code, false, false);
1595
Assert.Same(
SignInResult
.Failed, result);
1602
new object[] { IdentityResult.Success,
SignInResult
.LockedOut },
1603
new object[] { null,
SignInResult
.LockedOut },
1604
new object[] { IdentityResult.Failed(),
SignInResult
.Failed },
1609
public async Task CheckPasswordSignInLockedOutResultIsDependentOnTheAccessFailedAsyncResult(IdentityResult accessFailedResult,
SignInResult
expectedSignInResult)
1626
var
result = await helper.CheckPasswordSignInAsync(user, "[PLACEHOLDER]-bogus1", lockoutOnFailure: true);
1635
public async Task TwoFactorSignInLockedOutResultIsDependentOnTheAccessFailedAsyncResult(IdentityResult accessFailedResult,
SignInResult
expectedSignInResult)
1658
var
result = await helper.TwoFactorSignInAsync(provider, code, false, false);
Microsoft.AspNetCore.Identity.UI (8)
Areas\Identity\Pages\V4\Account\ExternalLogin.cshtml.cs (1)
141
var
result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false, bypassTwoFactor: true);
Areas\Identity\Pages\V4\Account\Login.cshtml.cs (1)
130
var
result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
Areas\Identity\Pages\V4\Account\LoginWith2fa.cshtml.cs (1)
126
var
result = await _signInManager.TwoFactorAuthenticatorSignInAsync(authenticatorCode, rememberMe, Input.RememberMachine);
Areas\Identity\Pages\V4\Account\LoginWithRecoveryCode.cshtml.cs (1)
109
var
result = await _signInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode);
Areas\Identity\Pages\V5\Account\ExternalLogin.cshtml.cs (1)
141
var
result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false, bypassTwoFactor: true);
Areas\Identity\Pages\V5\Account\Login.cshtml.cs (1)
130
var
result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
Areas\Identity\Pages\V5\Account\LoginWith2fa.cshtml.cs (1)
126
var
result = await _signInManager.TwoFactorAuthenticatorSignInAsync(authenticatorCode, rememberMe, Input.RememberMachine);
Areas\Identity\Pages\V5\Account\LoginWithRecoveryCode.cshtml.cs (1)
109
var
result = await _signInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode);
Microsoft.Extensions.Identity.Core (22)
SignInResult.cs (22)
11
private static readonly
SignInResult
_success = new SignInResult { Succeeded = true };
12
private static readonly
SignInResult
_failed = new SignInResult();
13
private static readonly
SignInResult
_lockedOut = new SignInResult { IsLockedOut = true };
14
private static readonly
SignInResult
_notAllowed = new SignInResult { IsNotAllowed = true };
15
private static readonly
SignInResult
_twoFactorRequired = new SignInResult { RequiresTwoFactor = true };
42
/// Returns a <see cref="
SignInResult
"/> that represents a successful sign-in.
44
/// <returns>A <see cref="
SignInResult
"/> that represents a successful sign-in.</returns>
45
public static
SignInResult
Success => _success;
48
/// Returns a <see cref="
SignInResult
"/> that represents a failed sign-in.
50
/// <returns>A <see cref="
SignInResult
"/> that represents a failed sign-in.</returns>
51
public static
SignInResult
Failed => _failed;
54
/// Returns a <see cref="
SignInResult
"/> that represents a sign-in attempt that failed because
57
/// <returns>A <see cref="
SignInResult
"/> that represents sign-in attempt that failed due to the
59
public static
SignInResult
LockedOut => _lockedOut;
62
/// Returns a <see cref="
SignInResult
"/> that represents a sign-in attempt that failed because
65
/// <returns>A <see cref="
SignInResult
"/> that represents sign-in attempt that failed due to the
67
public static
SignInResult
NotAllowed => _notAllowed;
70
/// Returns a <see cref="
SignInResult
"/> that represents a sign-in attempt that needs two-factor
73
/// <returns>A <see cref="
SignInResult
"/> that represents sign-in attempt that needs two-factor
75
public static
SignInResult
TwoFactorRequired => _twoFactorRequired;
78
/// Converts the value of the current <see cref="
SignInResult
"/> object to its equivalent string representation.
80
/// <returns>A string representation of value of the current <see cref="
SignInResult
"/> object.</returns>