public static IpAddressRequest GetCurrentIpAddress(bool?recordBadIp = null) { var request = RequestUtility.GetRequest(); return(new IpAddressRequest() { IpAddress = RequestUtility.GetClientIpAddress(request), CreatedUtcDateTime = DateTime.UtcNow, IsBadRequest = recordBadIp.GetValueOrDefault() }); }
private bool IsApiKeyInvalid() { var foundKey = RequestUtility.GetRequest().Headers.Get(HeaderKeyName); if (string.IsNullOrEmpty(foundKey)) { LogWarn("key not found in configuration file"); InvalidAction(); } var token = RequestUtility.GetRequest().Headers.Get(HeaderKeyName); bool matched = token != null && HeaderKeyValue == token; if (!matched) { LogWarn($"Invalid token from client - {token}"); InvalidAction(); } return(false); }