/// <summary> /// If the connected client isn't localhost throws SecurityException /// </summary> internal void EnsureClientIsLocalHost() { IPAddress clientIpAddress = CallContextExtensions.GetIpAddress(); if (clientIpAddress == null) { throw new SecurityException("This method can only be executed on the server. ClientIPAddress not set."); } if (IsLocalHost(clientIpAddress.ToString())) { return; } throw new SecurityException(String.Format("This method can only be executed on the server. ClientIPAddress is {0}", clientIpAddress)); }
private static void SetClientIpAddressDataHelper(ITransportHeaders headers) { var ip = headers[CommonTransportKeys.IPAddress] as IPAddress; CallContextExtensions.SetIpAddress(ip); }