mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-21 02:06:36 +00:00
feat(auth): implement ticket and API token authentication with session model
Add PveSession, PveAuthenticator, PveVersion, and PveAuthMode. Support ticket-based auth (username/password with 2hr expiry) and API token auth (USER@REALM!TOKENID=UUID format). Version detection on connect via GET /api2/json/version. Custom exception types for API errors, expired sessions, missing connections, version mismatches, and task failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using PSProxmoxVE.Core.Authentication;
|
||||
|
||||
namespace PSProxmoxVE.Core.Exceptions
|
||||
{
|
||||
/// <summary>Exception thrown when the connected Proxmox VE server does not meet the minimum version requirement for an operation</summary>
|
||||
public class PveVersionException : Exception
|
||||
{
|
||||
public int RequiredMajor { get; }
|
||||
public int RequiredMinor { get; }
|
||||
public PveVersion ActualVersion { get; }
|
||||
|
||||
public PveVersionException(int requiredMajor, int requiredMinor, PveVersion actualVersion)
|
||||
: base($"This operation requires Proxmox VE {requiredMajor}.{requiredMinor} or later. Connected server is version {actualVersion}.")
|
||||
{
|
||||
RequiredMajor = requiredMajor;
|
||||
RequiredMinor = requiredMinor;
|
||||
ActualVersion = actualVersion;
|
||||
}
|
||||
|
||||
public PveVersionException(int requiredMajor, int requiredMinor, PveVersion actualVersion, Exception innerException)
|
||||
: base($"This operation requires Proxmox VE {requiredMajor}.{requiredMinor} or later. Connected server is version {actualVersion}.", innerException)
|
||||
{
|
||||
RequiredMajor = requiredMajor;
|
||||
RequiredMinor = requiredMinor;
|
||||
ActualVersion = actualVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user