Files
tiku-backend.net/Tiku.Application/Auth/AuthExceptions.cs

25 lines
1.1 KiB
C#

namespace Tiku.Application.Auth;
public class AuthException(string code, string message) : Exception(message)
{
public string Code { get; } = code;
}
public sealed class InvalidCredentialsException(string code = "invalid_credentials")
: AuthException(code, "The supplied credentials are invalid.");
public sealed class TenantAccessDeniedException()
: AuthException("tenant_access_denied", "The user is not an active member of the requested tenant.");
public sealed class SessionRevokedException()
: AuthException("session_revoked", "The session has been revoked or expired.");
public sealed class SmsRateLimitedException()
: AuthException("sms_rate_limited", "SMS verification requests are rate limited.");
public sealed class AuthProviderNotConfiguredException(string provider)
: AuthException("auth_provider_not_configured", $"The {provider} auth provider is not configured.");
public sealed class InvalidAuthChallengeException(string code = "invalid_auth_challenge")
: AuthException(code, "The authentication challenge is invalid, consumed, or expired.");