mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
29 lines
636 B
C#
29 lines
636 B
C#
using Microsoft.AspNetCore.Http;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace Remotely.Server.Extensions;
|
|
|
|
public static class IHeaderDictionaryExtensions
|
|
{
|
|
public static bool TryGetOrganizationId(
|
|
this IHeaderDictionary headers,
|
|
[NotNullWhen(true)] out string? organizationId)
|
|
{
|
|
organizationId = null;
|
|
|
|
if (!headers.TryGetValue("OrganizationId", out var orgId))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
organizationId = $"{orgId}";
|
|
|
|
if (string.IsNullOrWhiteSpace(organizationId))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|