global_session 1.0.6 → 1.0.7
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.
data/global_session.gemspec
CHANGED
@@ -124,6 +124,9 @@ module GlobalSession
|
|
124
124
|
gs = request.env['global_session']
|
125
125
|
|
126
126
|
if gs && gs.id
|
127
|
+
session_data = {}
|
128
|
+
gs.each_pair { |key, value| session_data[key] = value }
|
129
|
+
|
127
130
|
session_id = gs.id + " (#{session[:session_id] || request.session_options[:id]})"
|
128
131
|
elsif session[:session_id]
|
129
132
|
session_id = session[:session_id]
|
@@ -135,6 +138,7 @@ module GlobalSession
|
|
135
138
|
request_id << "to #{params[:format]} " if params[:format]
|
136
139
|
request_id << "(for #{request_origin.split[0]}) [#{request.method.to_s.upcase}]"
|
137
140
|
request_id << "\n Session ID: #{session_id}" if session_id
|
141
|
+
request_id << "\n Session Data: #{session_data.inspect}" if session_data
|
138
142
|
|
139
143
|
logger.info(request_id)
|
140
144
|
|
@@ -16,6 +16,17 @@ module GlobalSession
|
|
16
16
|
class Session
|
17
17
|
attr_reader :id, :authority, :created_at, :expired_at, :directory
|
18
18
|
|
19
|
+
# Utility method to decode a cookie; good for console debugging. This performs no
|
20
|
+
# validation or security check of any sort.
|
21
|
+
#
|
22
|
+
# === Parameters
|
23
|
+
# cookie(String):: well-formed global session cookie
|
24
|
+
def self.decode_cookie(cookie)
|
25
|
+
zbin = Encoding::Base64Cookie.load(cookie)
|
26
|
+
json = Zlib::Inflate.inflate(zbin)
|
27
|
+
return Encoding::JSON.load(json)
|
28
|
+
end
|
29
|
+
|
19
30
|
# Create a new global session object.
|
20
31
|
#
|
21
32
|
# === Parameters
|
@@ -82,7 +93,7 @@ module GlobalSession
|
|
82
93
|
hash['dx'] = @insecure
|
83
94
|
hash['s'] = @signature
|
84
95
|
hash['a'] = authority
|
85
|
-
|
96
|
+
|
86
97
|
json = Encoding::JSON.dump(hash)
|
87
98
|
zbin = Zlib::Deflate.deflate(json, Zlib::BEST_COMPRESSION)
|
88
99
|
return Encoding::Base64Cookie.dump(zbin)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: global_session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 7
|
10
|
+
version: 1.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Spataro
|