last ...
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user