You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Connected.Security.Identity;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Security.Authentication;
|
|
|
|
|
|
|
|
|
|
internal class AuthenticationResult : IAuthenticationResult
|
|
|
|
|
{
|
|
|
|
|
public string? Token { get; init; }
|
|
|
|
|
|
|
|
|
|
public bool Success { get; init; }
|
|
|
|
|
|
|
|
|
|
public AuthenticationResultReason Reason { get; init; }
|
|
|
|
|
|
|
|
|
|
public IUser? User { get; init; }
|
|
|
|
|
|
|
|
|
|
public static IAuthenticationResult Fail(AuthenticationResultReason reason)
|
|
|
|
|
{
|
|
|
|
|
return new AuthenticationResult
|
|
|
|
|
{
|
|
|
|
|
Success = false,
|
|
|
|
|
Reason = reason
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IAuthenticationResult OK(IUser user, string token)
|
|
|
|
|
{
|
|
|
|
|
return new AuthenticationResult
|
|
|
|
|
{
|
|
|
|
|
Success = true,
|
|
|
|
|
Token = token,
|
|
|
|
|
User = user
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|