balrog 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed08c9a6aa5d68fc2c81f784ea2bd330353c64a1e8ee8729acc6dc65fa4e0da2
4
- data.tar.gz: 826d7ab7ed00637b9ac8642b44b93909b727bd2ae0971a872fab695d96d9f677
3
+ metadata.gz: c908a9916866b576a2914041573fed0ae64555a1956b3a94a3c36e37476e7cf6
4
+ data.tar.gz: 814d65c1b25cfe3e3a561daed8091643694ce81a70eb543eaa40c09939689183
5
5
  SHA512:
6
- metadata.gz: 0c0577f269883d820021d35af147e6746868c1dd20581d25919e9f3938657bc780571ae5978f13d8c7caea91baf63c39539271b2cffbbf3f2d306eef7b911120
7
- data.tar.gz: 884d62c762f25c50c562d190d93452438680b33607cd53d4dd50921a2c9fa13419e1aae2ccd5cfeb8b34f9f2582ab4348e87b53961f853c441f2607df3d04fd7
6
+ metadata.gz: 58872926e04fd6bafd1bdb12915d5a3e0aad33a7e79a82ac074cad45bd8da011cd1f760aae6cb6a8035fd2f1beb2d4a6f16cc2b2c4e3a1ec78718eef4f61b732
7
+ data.tar.gz: b1c7fd33821672a9f59818fe5a543fca3c5d14221d1fac6ff23b5566ec53e63cc2d8f07323057793094edbb7bf5673c72f64bd802cc97febda0973eb5169e7d3
@@ -1,119 +1,119 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- balrog (2.0.0)
4
+ balrog (2.0.1)
5
5
  bcrypt (~> 3.0)
6
6
  rails (>= 5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.0.1)
12
- actionpack (= 6.0.1)
11
+ actioncable (6.0.2.2)
12
+ actionpack (= 6.0.2.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.1)
16
- actionpack (= 6.0.1)
17
- activejob (= 6.0.1)
18
- activerecord (= 6.0.1)
19
- activestorage (= 6.0.1)
20
- activesupport (= 6.0.1)
15
+ actionmailbox (6.0.2.2)
16
+ actionpack (= 6.0.2.2)
17
+ activejob (= 6.0.2.2)
18
+ activerecord (= 6.0.2.2)
19
+ activestorage (= 6.0.2.2)
20
+ activesupport (= 6.0.2.2)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.0.1)
23
- actionpack (= 6.0.1)
24
- actionview (= 6.0.1)
25
- activejob (= 6.0.1)
22
+ actionmailer (6.0.2.2)
23
+ actionpack (= 6.0.2.2)
24
+ actionview (= 6.0.2.2)
25
+ activejob (= 6.0.2.2)
26
26
  mail (~> 2.5, >= 2.5.4)
27
27
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.1)
29
- actionview (= 6.0.1)
30
- activesupport (= 6.0.1)
31
- rack (~> 2.0)
28
+ actionpack (6.0.2.2)
29
+ actionview (= 6.0.2.2)
30
+ activesupport (= 6.0.2.2)
31
+ rack (~> 2.0, >= 2.0.8)
32
32
  rack-test (>= 0.6.3)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.1)
36
- actionpack (= 6.0.1)
37
- activerecord (= 6.0.1)
38
- activestorage (= 6.0.1)
39
- activesupport (= 6.0.1)
35
+ actiontext (6.0.2.2)
36
+ actionpack (= 6.0.2.2)
37
+ activerecord (= 6.0.2.2)
38
+ activestorage (= 6.0.2.2)
39
+ activesupport (= 6.0.2.2)
40
40
  nokogiri (>= 1.8.5)
41
- actionview (6.0.1)
42
- activesupport (= 6.0.1)
41
+ actionview (6.0.2.2)
42
+ activesupport (= 6.0.2.2)
43
43
  builder (~> 3.1)
44
44
  erubi (~> 1.4)
45
45
  rails-dom-testing (~> 2.0)
46
46
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.1)
48
- activesupport (= 6.0.1)
47
+ activejob (6.0.2.2)
48
+ activesupport (= 6.0.2.2)
49
49
  globalid (>= 0.3.6)
50
- activemodel (6.0.1)
51
- activesupport (= 6.0.1)
52
- activerecord (6.0.1)
53
- activemodel (= 6.0.1)
54
- activesupport (= 6.0.1)
55
- activestorage (6.0.1)
56
- actionpack (= 6.0.1)
57
- activejob (= 6.0.1)
58
- activerecord (= 6.0.1)
50
+ activemodel (6.0.2.2)
51
+ activesupport (= 6.0.2.2)
52
+ activerecord (6.0.2.2)
53
+ activemodel (= 6.0.2.2)
54
+ activesupport (= 6.0.2.2)
55
+ activestorage (6.0.2.2)
56
+ actionpack (= 6.0.2.2)
57
+ activejob (= 6.0.2.2)
58
+ activerecord (= 6.0.2.2)
59
59
  marcel (~> 0.3.1)
60
- activesupport (6.0.1)
60
+ activesupport (6.0.2.2)
61
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
62
  i18n (>= 0.7, < 2)
63
63
  minitest (~> 5.1)
64
64
  tzinfo (~> 1.1)
65
65
  zeitwerk (~> 2.2)
66
66
  bcrypt (3.1.13)
67
- builder (3.2.3)
68
- concurrent-ruby (1.1.5)
69
- crass (1.0.5)
67
+ builder (3.2.4)
68
+ concurrent-ruby (1.1.6)
69
+ crass (1.0.6)
70
70
  diff-lcs (1.3)
71
71
  erubi (1.9.0)
72
72
  globalid (0.4.2)
73
73
  activesupport (>= 4.2.0)
74
- i18n (1.7.0)
74
+ i18n (1.8.2)
75
75
  concurrent-ruby (~> 1.0)
76
- loofah (2.3.1)
76
+ loofah (2.5.0)
77
77
  crass (~> 1.0.2)
78
78
  nokogiri (>= 1.5.9)
79
79
  mail (2.7.1)
80
80
  mini_mime (>= 0.1.1)
81
81
  marcel (0.3.3)
82
82
  mimemagic (~> 0.3.2)
83
- method_source (0.9.2)
84
- mimemagic (0.3.3)
83
+ method_source (1.0.0)
84
+ mimemagic (0.3.4)
85
85
  mini_mime (1.0.2)
86
86
  mini_portile2 (2.4.0)
87
- minitest (5.13.0)
87
+ minitest (5.14.0)
88
88
  nio4r (2.5.2)
89
- nokogiri (1.10.5)
89
+ nokogiri (1.10.9)
90
90
  mini_portile2 (~> 2.4.0)
91
- rack (2.0.7)
91
+ rack (2.2.2)
92
92
  rack-test (1.1.0)
93
93
  rack (>= 1.0, < 3)
94
- rails (6.0.1)
95
- actioncable (= 6.0.1)
96
- actionmailbox (= 6.0.1)
97
- actionmailer (= 6.0.1)
98
- actionpack (= 6.0.1)
99
- actiontext (= 6.0.1)
100
- actionview (= 6.0.1)
101
- activejob (= 6.0.1)
102
- activemodel (= 6.0.1)
103
- activerecord (= 6.0.1)
104
- activestorage (= 6.0.1)
105
- activesupport (= 6.0.1)
94
+ rails (6.0.2.2)
95
+ actioncable (= 6.0.2.2)
96
+ actionmailbox (= 6.0.2.2)
97
+ actionmailer (= 6.0.2.2)
98
+ actionpack (= 6.0.2.2)
99
+ actiontext (= 6.0.2.2)
100
+ actionview (= 6.0.2.2)
101
+ activejob (= 6.0.2.2)
102
+ activemodel (= 6.0.2.2)
103
+ activerecord (= 6.0.2.2)
104
+ activestorage (= 6.0.2.2)
105
+ activesupport (= 6.0.2.2)
106
106
  bundler (>= 1.3.0)
107
- railties (= 6.0.1)
107
+ railties (= 6.0.2.2)
108
108
  sprockets-rails (>= 2.0.0)
109
109
  rails-dom-testing (2.0.3)
110
110
  activesupport (>= 4.2.0)
111
111
  nokogiri (>= 1.6)
112
112
  rails-html-sanitizer (1.3.0)
113
113
  loofah (~> 2.3)
114
- railties (6.0.1)
115
- actionpack (= 6.0.1)
116
- activesupport (= 6.0.1)
114
+ railties (6.0.2.2)
115
+ actionpack (= 6.0.2.2)
116
+ activesupport (= 6.0.2.2)
117
117
  method_source
118
118
  rake (>= 0.8.7)
119
119
  thor (>= 0.20.3, < 2.0)
@@ -138,14 +138,14 @@ GEM
138
138
  actionpack (>= 4.0)
139
139
  activesupport (>= 4.0)
140
140
  sprockets (>= 3.0.0)
141
- thor (0.20.3)
141
+ thor (1.0.1)
142
142
  thread_safe (0.3.6)
143
- tzinfo (1.2.5)
143
+ tzinfo (1.2.7)
144
144
  thread_safe (~> 0.1)
145
145
  websocket-driver (0.7.1)
146
146
  websocket-extensions (>= 0.1.0)
147
147
  websocket-extensions (0.1.4)
148
- zeitwerk (2.2.1)
148
+ zeitwerk (2.3.0)
149
149
 
150
150
  PLATFORMS
151
151
  ruby
data/README.md CHANGED
@@ -220,11 +220,19 @@ end
220
220
 
221
221
  ### Running the tests
222
222
 
223
- Tests are part of the dummy Rails app within the spec folder:
223
+ Tests are part of the dummy Rails app within the spec folder. To run the tests:
224
224
 
225
225
  ```
226
226
  $ cd spec/dummy-rails-app
227
227
  $ bundle
228
+ $ rails generate active_record:session_migration
229
+ $ redis-server
230
+ ```
231
+
232
+ Then in a different terminal:
233
+
234
+ ```
235
+ $ cd spec/dummy-rails-app
228
236
  $ rspec
229
237
  ```
230
238
 
@@ -2,6 +2,7 @@
2
2
  <html lang=en>
3
3
  <head>
4
4
  <meta charset=utf-8>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
6
  <title>Login</title>
6
7
  <%= stylesheet_link_tag "balrog/gate" %>
7
8
  </head>
@@ -2,7 +2,7 @@
2
2
  # and that the session hasn't expired.
3
3
  module Balrog::Guard
4
4
  def authenticated?(balrog_session)
5
- @balrog_session = balrog_session
5
+ @balrog_session = balrog_session&.with_indifferent_access
6
6
  previously_authenticated? && still_valid?
7
7
  end
8
8
 
@@ -11,14 +11,14 @@ module Balrog::Guard
11
11
  # A method to check that the user has been authenticated before.
12
12
  def previously_authenticated?
13
13
  return false unless @balrog_session
14
- @balrog_session['value'] == 'authenticated'
14
+ @balrog_session[:value] == 'authenticated'
15
15
  end
16
16
 
17
17
  # A method to check that the authentication has not expired.
18
18
  def still_valid?
19
19
  # If the user did not set configured the Balrog session
20
20
  # to expire, the cookie is valid.
21
- return true unless @balrog_session['expiry_date']
22
- DateTime.current < @balrog_session['expiry_date']
21
+ return true unless @balrog_session[:expiry_date]
22
+ DateTime.current < @balrog_session[:expiry_date]
23
23
  end
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module Balrog
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balrog
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pixie Labs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-05 00:00:00.000000000 Z
11
+ date: 2020-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -125,7 +125,7 @@ homepage: https://github.com/pixielabs/balrog
125
125
  licenses:
126
126
  - MIT
127
127
  metadata: {}
128
- post_install_message:
128
+ post_install_message:
129
129
  rdoc_options: []
130
130
  require_paths:
131
131
  - lib
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubygems_version: 3.0.3
144
- signing_key:
144
+ signing_key:
145
145
  specification_version: 4
146
146
  summary: An alternative to HTTP basic auth
147
147
  test_files: []