hash-auth 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,20 +54,23 @@ module HashAuth
54
54
 
55
55
  def check_ip(ip)
56
56
  return true if @client.valid_ips.length == 0
57
- @client.valid_ips.each { |valid_ip| return true if ip == valid_ip }
57
+ @client.valid_ips.each do |valid_ip|
58
+ match = regexp_from_string(valid_ip).match(ip)
59
+ return true if match != nil
60
+ end
58
61
  false
59
62
  end
60
63
 
61
64
  def check_host(host)
62
65
  return true if @client.valid_domains.length == 0
63
66
  @client.valid_domains.each do |d|
64
- match = regexp_from_host(d).match(host)
67
+ match = regexp_from_string(d).match(host)
65
68
  return true if match != nil
66
69
  end
67
70
  false
68
71
  end
69
72
 
70
- def regexp_from_host(host)
73
+ def regexp_from_string(host)
71
74
  Regexp.new '^'+host.gsub('.','\.').gsub('*', '.*') + '$'
72
75
  end
73
76
 
@@ -1,3 +1,3 @@
1
1
  module HashAuth
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-27 00:00:00.000000000 Z
12
+ date: 2013-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 1.8.23
104
+ rubygems_version: 1.8.25
105
105
  signing_key:
106
106
  specification_version: 3
107
107
  summary: Rails gem to authenticate HTTP requests by hashing request components and