Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HttpAuthModule/HttpAuthModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void InitializeStatic()

var restrictIPAddresses = Config.Get("RestrictIPAddresses");
if (!string.IsNullOrEmpty(restrictIPAddresses))
_authStrategies.Add(new RestictIPStrategy(restrictIPAddresses));
_authStrategies.Add(new RestrictIPStrategy(restrictIPAddresses));

switch (Config.Get("AuthMode").ToLower())
{
Expand Down
2 changes: 1 addition & 1 deletion HttpAuthModule/HttpAuthModule.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<Compile Include="IAuthStrategy.cs" />
<Compile Include="IPAddressRange.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RestictIPStrategy.cs" />
<Compile Include="RestrictIPStrategy.cs" />
</ItemGroup>
<ItemGroup>
<None Include="HttpAuthModule.nuspec" />
Expand Down
8 changes: 4 additions & 4 deletions HttpAuthModule/IPAddressRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace HttpAuthModule
internal class IPAddressRange
{
private AddressFamily _addressFamily;
private byte[] _netowrkAddressBytes;
private byte[] _networkAddressBytes;
private byte[] _subnetMaskBytes;

/// <param name="ipRangeStr">
Expand Down Expand Up @@ -42,8 +42,8 @@ public IPAddressRange(string ipRangeString)
else
maskRange = maxMaskRange;

_netowrkAddressBytes = ipAddr.GetAddressBytes();
_subnetMaskBytes = Enumerable.Repeat<byte>(0xFF, _netowrkAddressBytes.Length).ToArray();
_networkAddressBytes = ipAddr.GetAddressBytes();
_subnetMaskBytes = Enumerable.Repeat<byte>(0xFF, _networkAddressBytes.Length).ToArray();

for (int i = 0; i < (maxMaskRange - maskRange); i++)
_subnetMaskBytes[_subnetMaskBytes.Length - 1 - i / 8] -= (byte)(1 << (i % 8));
Expand All @@ -56,7 +56,7 @@ public bool IsInRange(IPAddress ipAddr)

var addrBytes = ipAddr.GetAddressBytes();
for (int i = 0; i < addrBytes.Length; i++)
if ((addrBytes[i] & _subnetMaskBytes[i]) != _netowrkAddressBytes[i])
if ((addrBytes[i] & _subnetMaskBytes[i]) != _networkAddressBytes[i])
return false;

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace HttpAuthModule
{
internal class RestictIPStrategy : IAuthStrategy
internal class RestrictIPStrategy : IAuthStrategy
{
private IPAddressRange[] _ranges;

public RestictIPStrategy(string ipAddresses)
public RestrictIPStrategy(string ipAddresses)
{
_ranges = ipAddresses.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(s => new IPAddressRange(s))
Expand Down