rack-auth-cookie 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack/auth/cookie.rb +17 -7
- data/rack-auth-cookie.gemspec +1 -1
- data/test/test_rack_auth_cookie.rb +1 -1
- metadata +3 -3
data/lib/rack/auth/cookie.rb
CHANGED
@@ -6,7 +6,7 @@ module Rack
|
|
6
6
|
module Auth
|
7
7
|
class Cookie
|
8
8
|
# The version of the rack-auth-cookie library.
|
9
|
-
VERSION = '0.7.
|
9
|
+
VERSION = '0.7.4'
|
10
10
|
|
11
11
|
# Creates a new Rack::Auth::Cookie object.
|
12
12
|
#
|
@@ -202,7 +202,7 @@ module Rack
|
|
202
202
|
def self.create_auth_cookie(env)
|
203
203
|
cookie_value = create_auth_token(env)
|
204
204
|
cookie = "#{@@cookie_name}=#{URI.escape(cookie_value)}; "
|
205
|
-
cookie += "domain
|
205
|
+
cookie += "domain=#{cookie_domain(env)}; "
|
206
206
|
cookie += "path=/; "
|
207
207
|
cookie += "HttpOnly; "
|
208
208
|
end
|
@@ -210,7 +210,7 @@ module Rack
|
|
210
210
|
def self.create_clear_cookie(env)
|
211
211
|
cookie_value = ""
|
212
212
|
cookie = "#{@@cookie_name}=; "
|
213
|
-
cookie += "domain
|
213
|
+
cookie += "domain=#{cookie_domain(env)}; "
|
214
214
|
cookie += "path=/; "
|
215
215
|
cookie += "expires=Thu, 01-Jan-1970 00:00:00 GMT; "
|
216
216
|
cookie += "HttpOnly; "
|
@@ -233,10 +233,20 @@ module Rack
|
|
233
233
|
raw_host_with_port(env).sub(/:\d+$/, '')
|
234
234
|
end
|
235
235
|
|
236
|
-
def self.
|
237
|
-
|
238
|
-
|
239
|
-
|
236
|
+
def self.cookie_domain(env)
|
237
|
+
result = host(env)
|
238
|
+
|
239
|
+
if @@domain_tree_depth != nil
|
240
|
+
components = result.split('.')
|
241
|
+
components.slice!(0, @@domain_tree_depth)
|
242
|
+
result = components.join('.')
|
243
|
+
end
|
244
|
+
|
245
|
+
if @@share_with_subdomains
|
246
|
+
result += "."
|
247
|
+
end
|
248
|
+
|
249
|
+
result
|
240
250
|
end
|
241
251
|
end
|
242
252
|
end
|
data/rack-auth-cookie.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'rack-auth-cookie'
|
5
|
-
gem.version = '0.7.
|
5
|
+
gem.version = '0.7.4'
|
6
6
|
gem.authors = ["Daniel Berger", "Charlie O'Keefe"]
|
7
7
|
gem.email = 'cokeefe@globe.gov'
|
8
8
|
gem.homepage = 'http://www.github.com/charlieok/rack-auth-cookie'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-auth-cookie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 4
|
10
|
+
version: 0.7.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Berger
|