[CHANGE] Reworked client creation

This commit is contained in:
max
2025-09-08 21:28:33 +02:00
parent b2c9fc2c52
commit 680b6d2cc9
19 changed files with 563 additions and 1347 deletions

View File

@@ -10,16 +10,27 @@ public static class AuthenticationUtilities
private const string HeaderScheme = "SAPISIDHASH";
// Dave Thomas & windy for updated answer @ https://stackoverflow.com/a/32065323/9948300
public static AuthenticationHeaderValue? GetSapisidHashHeader(string datasyncId, string sapisid, string origin)
public static AuthenticationHeaderValue GetSapisidHashHeader(string datasyncId, string sapisid, string origin)
{
var strHash = GetSapisidHash(datasyncId, sapisid, origin);
return strHash == null ? null : new AuthenticationHeaderValue(HeaderScheme, strHash);
return new AuthenticationHeaderValue(HeaderScheme, strHash);
}
public static string? GetSapisidHash(string datasyncId, string sapisid, string origin, string? time = null)
public static string GetSapisidHash(string datasyncId, string sapisid, string origin, string? time = null)
{
if (string.IsNullOrWhiteSpace(datasyncId) || string.IsNullOrWhiteSpace(sapisid) || string.IsNullOrWhiteSpace(origin))
return null;
if (string.IsNullOrWhiteSpace(datasyncId))
{
throw new ArgumentNullException(nameof(datasyncId));
}
if (string.IsNullOrWhiteSpace(sapisid))
{
throw new ArgumentNullException(nameof(sapisid));
}
if (string.IsNullOrWhiteSpace(origin))
{
throw new ArgumentNullException(nameof(origin));
}
datasyncId = datasyncId.Replace("||", "");
sapisid = Uri.UnescapeDataString(sapisid);
if (string.IsNullOrWhiteSpace(time))