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.
Connected.Framework/Connected.Security/Authentication/AuthenticationResult.cs

34 lines
651 B

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
};
}
}