2020-12-03 19:36:38 +11:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
2020-11-27 13:34:58 +01:00
|
|
|
|
2024-02-27 12:40:30 +01:00
|
|
|
namespace Umbraco.Cms.Api.Management.Security;
|
2022-06-20 08:37:17 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Result returned from signing in when auto-linking takes place
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AutoLinkSignInResult : SignInResult
|
2020-11-27 13:34:58 +01:00
|
|
|
{
|
2022-06-20 08:37:17 +02:00
|
|
|
public AutoLinkSignInResult(IReadOnlyCollection<string> errors) =>
|
|
|
|
|
Errors = errors ?? throw new ArgumentNullException(nameof(errors));
|
|
|
|
|
|
|
|
|
|
public AutoLinkSignInResult()
|
2020-11-27 13:34:58 +01:00
|
|
|
{
|
|
|
|
|
}
|
2022-06-20 08:37:17 +02:00
|
|
|
|
|
|
|
|
public static AutoLinkSignInResult FailedNotLinked { get; } = new() { Succeeded = false };
|
|
|
|
|
|
|
|
|
|
public static AutoLinkSignInResult FailedNoEmail { get; } = new() { Succeeded = false };
|
|
|
|
|
|
|
|
|
|
public IReadOnlyCollection<string> Errors { get; } = Array.Empty<string>();
|
|
|
|
|
|
|
|
|
|
public static AutoLinkSignInResult FailedException(string error) => new(new[] { error }) { Succeeded = false };
|
|
|
|
|
|
|
|
|
|
public static AutoLinkSignInResult FailedCreatingUser(IReadOnlyCollection<string> errors) =>
|
|
|
|
|
new(errors) { Succeeded = false };
|
|
|
|
|
|
|
|
|
|
public static AutoLinkSignInResult FailedLinkingUser(IReadOnlyCollection<string> errors) =>
|
|
|
|
|
new(errors) { Succeeded = false };
|
2020-11-27 13:34:58 +01:00
|
|
|
}
|