This commit is contained in:
2026-10-17 17:15:07 +03:30
parent ae17ffa17b
commit b5848b96e7
2 changed files with 47 additions and 0 deletions
+2
View File
@@ -11,6 +11,8 @@ namespace xIdentityModels.Dtos
public struct XOpenActions
{
public const string HandShake = "HandShake";
public const string GetApiKey = "GetApiKey";
public const string UseApiKey = "UseApiKey";
public const string GetUserInfo = "GetUserInfo";
public const string GetUserInfos = "GetUserInfos";
}
+45
View File
@@ -385,6 +385,51 @@ namespace xIdentityModels.Extensions
return result;
}
/// <summary>
/// Check Dest Client IP is Exists in Source or not ...
/// </summary>
/// <param name="source"></param>
/// <param name="dest"></param>
/// <returns></returns>
public static bool IsClientIpPassed(
this IEnumerable<string> source,
string dest
)
{
//
// if Allowed IPs Empty means all Client IPs is Valid ...
var result =
!source.HasChild();
if (result)
{
return result;
}
//
result = !dest.IsNullOrEmpty();
if (!result)
{
return result;
}
//
result = source.Any(s => s.ToNormalString() == dest.ToNormalString());
if (!result)
{
//
if (dest == "::1")
{
//
result = source.Any(s =>
s.ToNormalString() == "127.0.0.1" ||
s.ToNormalString() == "localhost");
}
}
//
return result;
}
/// <summary>
/// Check Specified User Contains Specified UserSelectByParam or not ...
/// </summary>