mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-22 10:46:37 +00:00
feat: add firewall, backup, and SDN IPAM/DNS/controller cmdlets
Add 35 new cmdlets bringing the total to 118: - Firewall (21): rules, groups, aliases, IP sets, options at cluster/node/VM/container levels - Backup (5): ad-hoc vzdump and scheduled backup job CRUD - SDN IPAM/DNS/Controller (9): plugin management for SDN subsystem Also includes: - Fix: Remove-PveRole now has ConfirmImpact.High - Fix: URL-encode snapshot names in API paths - Refactor: extract auth header strings to constants in PveHttpClient - Add PSGallery version badge to README - Full test coverage: 11 JSON fixtures, xUnit model tests, Pester unit tests, and integration tests for firewall/backup/OVA import - Updated manifest, format file, CHANGELOG, README, API coverage docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,10 @@ namespace PSProxmoxVE.Core.Client
|
||||
private readonly HttpClient _httpClient;
|
||||
private bool _disposed;
|
||||
|
||||
private const string ApiTokenPrefix = "PVEAPIToken=";
|
||||
private const string AuthCookieName = "PVEAuthCookie=";
|
||||
private const string CsrfHeaderName = "CSRFPreventionToken";
|
||||
|
||||
/// <summary>
|
||||
/// Creates an HTTP client authenticated with the specified PVE session.
|
||||
/// </summary>
|
||||
@@ -313,14 +317,14 @@ namespace PSProxmoxVE.Core.Client
|
||||
|
||||
if (_session.AuthMode == PveAuthMode.ApiToken)
|
||||
{
|
||||
request.Headers.TryAddWithoutValidation("Authorization", $"PVEAPIToken={_session.ApiToken}");
|
||||
request.Headers.TryAddWithoutValidation("Authorization", $"{ApiTokenPrefix}{_session.ApiToken}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ticket auth
|
||||
request.Headers.Add("Cookie", $"PVEAuthCookie={_session.Ticket}");
|
||||
request.Headers.Add("Cookie", $"{AuthCookieName}{_session.Ticket}");
|
||||
if (mutating && !string.IsNullOrEmpty(_session.CsrfToken))
|
||||
request.Headers.Add("CSRFPreventionToken", _session.CsrfToken);
|
||||
request.Headers.Add(CsrfHeaderName, _session.CsrfToken);
|
||||
}
|
||||
|
||||
return request;
|
||||
|
||||
Reference in New Issue
Block a user