Initial curated ITWorx_MCP_Hub source from 368fba691ea8d23403b4d56b53b5ec670d7c5020
This commit is contained in:
commit
cb5be898ea
663 files changed
+82674
No files matched your search
@@ -0,0 +1,58 @@
|
||||
"""Safe, stable authentication errors."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
class AuthError(Exception):
|
||||
"""An error whose public code/message is safe to expose to a caller."""
|
||||
|
||||
code = "authentication_failed"
|
||||
public_message = "Authentication failed."
|
||||
|
||||
def __init__(self, message: str | None = None) -> None:
|
||||
super().__init__(message or self.public_message)
|
||||
|
||||
|
||||
class ConfigurationError(AuthError):
|
||||
code = "authentication_configuration_error"
|
||||
public_message = "Authentication is not configured."
|
||||
|
||||
|
||||
class ProviderUnavailable(AuthError):
|
||||
code = "identity_provider_unavailable"
|
||||
public_message = "The identity provider is temporarily unavailable."
|
||||
|
||||
|
||||
class InvalidToken(AuthError):
|
||||
code = "invalid_token"
|
||||
public_message = "The supplied credential is invalid."
|
||||
|
||||
|
||||
class TokenExchangeError(AuthError):
|
||||
code = "token_exchange_failed"
|
||||
public_message = "Authentication could not be completed."
|
||||
|
||||
|
||||
class InvalidState(AuthError):
|
||||
code = "invalid_auth_state"
|
||||
public_message = "Authentication could not be completed."
|
||||
|
||||
|
||||
class CSRFError(AuthError):
|
||||
code = "csrf_failed"
|
||||
public_message = "The request could not be verified."
|
||||
|
||||
|
||||
class SessionExpired(AuthError):
|
||||
code = "session_expired"
|
||||
public_message = "The session has expired."
|
||||
|
||||
|
||||
class UnknownMachinePrincipal(AuthError):
|
||||
code = "unknown_machine_principal"
|
||||
public_message = "The machine client is not registered."
|
||||
|
||||
|
||||
class RevokedMachinePrincipal(AuthError):
|
||||
code = "revoked_machine_principal"
|
||||
public_message = "The machine client is disabled."
|
||||
Reference in new issue
Block a user