rack-session-encryptedcookie 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/lib/rack/session/encryptedcookie.rb +22 -19
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75afd9e596f1a7ab8caf49d3a3a690010b565d59
|
|
4
|
+
data.tar.gz: 5182c264b5d0de603858cc647ca1b7b75f16ea15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41e88e571e77d8e20f7de844af405c5c64acfd2a287c8a48783471bc02be858db75865d8b977fa8c23dd5857702d28ea777b106341998eb89211ea02b524484f
|
|
7
|
+
data.tar.gz: 7f3a25d3187c81b2f083df825c5c2c6c5e54d288c80eeb1d13a6be32fc9a64ac32b51f5ed509f75634743f9581e294c77bca7f432c2e492bd0a65132d90a3bee
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Rack::Session::EncryptedCookie - Encrypted session middleware for Rack
|
|
3
3
|
#
|
|
4
|
-
# Copyright (C) 2013 -
|
|
4
|
+
# Copyright (C) 2013 - 2018 Tim Hentenaar. All Rights Reserved.
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Simplified BSD License.
|
|
7
7
|
# See the LICENSE file for details.
|
|
@@ -17,28 +17,30 @@ module Session
|
|
|
17
17
|
NOT_FOUND = [ 404, {}, [ 'Not found' ]].freeze
|
|
18
18
|
|
|
19
19
|
# @param [Hash] opts Session options
|
|
20
|
-
# @option opts [String] :cookie_name
|
|
21
|
-
# @option opts [String] :domain
|
|
22
|
-
# @option opts [Boolean] :http_only
|
|
23
|
-
# @option opts [Integer] :expires
|
|
24
|
-
# @option opts [String] :cipher
|
|
25
|
-
# @option opts [String] :salt
|
|
26
|
-
# @optons opts [Integer] :rounds
|
|
27
|
-
# @option opts [String] :key
|
|
28
|
-
# @option opts [Integer] :tag_len
|
|
20
|
+
# @option opts [String] :cookie_name Cookie name
|
|
21
|
+
# @option opts [String] :domain Domain for the cookie
|
|
22
|
+
# @option opts [Boolean] :http_only HttpOnly for the cookie
|
|
23
|
+
# @option opts [Integer] :expires Cookie expiry (in seconds)
|
|
24
|
+
# @option opts [String] :cipher OpenSSL cipher to use
|
|
25
|
+
# @option opts [String] :salt Salt for the IV
|
|
26
|
+
# @optons opts [Integer] :rounds Number of salting rounds
|
|
27
|
+
# @option opts [String] :key Encryption key for the data
|
|
28
|
+
# @option opts [Integer] :tag_len Tag length (for GCM/CCM ciphers)
|
|
29
|
+
# @option opts [Boolean] :clear_cookies Clear response cookies
|
|
29
30
|
def initialize(app, opts={})
|
|
30
31
|
@app = app
|
|
31
32
|
@hash = {}
|
|
32
33
|
@opts = {
|
|
33
|
-
cookie_name:
|
|
34
|
-
domain:
|
|
35
|
-
http_only:
|
|
36
|
-
expires:
|
|
37
|
-
cipher:
|
|
38
|
-
salt:
|
|
39
|
-
rounds:
|
|
40
|
-
key:
|
|
41
|
-
tag_len:
|
|
34
|
+
cookie_name: 'rack.session',
|
|
35
|
+
domain: nil,
|
|
36
|
+
http_only: false,
|
|
37
|
+
expires: (15 * 60),
|
|
38
|
+
cipher: 'aes-256-cbc',
|
|
39
|
+
salt: '3@bG>B@J5vy-FeXJ',
|
|
40
|
+
rounds: 2000,
|
|
41
|
+
key: 'r`*BqnG:c^;AL{k97=KYN!#',
|
|
42
|
+
tag_len: 16,
|
|
43
|
+
clear_cookies: false
|
|
42
44
|
}.merge(opts)
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -99,6 +101,7 @@ module Session
|
|
|
99
101
|
c[:expires] = Time.at(Time.now + @opts[:expires])
|
|
100
102
|
end
|
|
101
103
|
|
|
104
|
+
r[1]['Set-Cookie'] = nil if @opts[:clear_cookies]
|
|
102
105
|
r[1]['Set-Cookie'] = Rack::Utils.add_cookie_to_header(
|
|
103
106
|
r[1]['Set-Cookie'], @opts[:cookie_name], c
|
|
104
107
|
) unless data.nil?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-session-encryptedcookie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Hentenaar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -52,8 +52,7 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '2.0'
|
|
55
|
-
description:
|
|
56
|
-
Rack middleware that persists session data in an encrypted cookie
|
|
55
|
+
description: " Rack middleware that persists session data in an encrypted cookie\n"
|
|
57
56
|
email: tim.hentenaar@gmail.com
|
|
58
57
|
executables: []
|
|
59
58
|
extensions: []
|