balrog 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +65 -65
- data/README.md +9 -1
- data/app/views/layouts/balrog.html.erb +1 -0
- data/lib/balrog/guard.rb +4 -4
- data/lib/balrog/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c908a9916866b576a2914041573fed0ae64555a1956b3a94a3c36e37476e7cf6
|
4
|
+
data.tar.gz: 814d65c1b25cfe3e3a561daed8091643694ce81a70eb543eaa40c09939689183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58872926e04fd6bafd1bdb12915d5a3e0aad33a7e79a82ac074cad45bd8da011cd1f760aae6cb6a8035fd2f1beb2d4a6f16cc2b2c4e3a1ec78718eef4f61b732
|
7
|
+
data.tar.gz: b1c7fd33821672a9f59818fe5a543fca3c5d14221d1fac6ff23b5566ec53e63cc2d8f07323057793094edbb7bf5673c72f64bd802cc97febda0973eb5169e7d3
|
data/Gemfile.lock
CHANGED
@@ -1,119 +1,119 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
balrog (2.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.
|
12
|
-
actionpack (= 6.0.
|
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.
|
16
|
-
actionpack (= 6.0.
|
17
|
-
activejob (= 6.0.
|
18
|
-
activerecord (= 6.0.
|
19
|
-
activestorage (= 6.0.
|
20
|
-
activesupport (= 6.0.
|
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.
|
23
|
-
actionpack (= 6.0.
|
24
|
-
actionview (= 6.0.
|
25
|
-
activejob (= 6.0.
|
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.
|
29
|
-
actionview (= 6.0.
|
30
|
-
activesupport (= 6.0.
|
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.
|
36
|
-
actionpack (= 6.0.
|
37
|
-
activerecord (= 6.0.
|
38
|
-
activestorage (= 6.0.
|
39
|
-
activesupport (= 6.0.
|
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.
|
42
|
-
activesupport (= 6.0.
|
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.
|
48
|
-
activesupport (= 6.0.
|
47
|
+
activejob (6.0.2.2)
|
48
|
+
activesupport (= 6.0.2.2)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.0.
|
51
|
-
activesupport (= 6.0.
|
52
|
-
activerecord (6.0.
|
53
|
-
activemodel (= 6.0.
|
54
|
-
activesupport (= 6.0.
|
55
|
-
activestorage (6.0.
|
56
|
-
actionpack (= 6.0.
|
57
|
-
activejob (= 6.0.
|
58
|
-
activerecord (= 6.0.
|
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.
|
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.
|
68
|
-
concurrent-ruby (1.1.
|
69
|
-
crass (1.0.
|
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.
|
74
|
+
i18n (1.8.2)
|
75
75
|
concurrent-ruby (~> 1.0)
|
76
|
-
loofah (2.
|
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.
|
84
|
-
mimemagic (0.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.
|
87
|
+
minitest (5.14.0)
|
88
88
|
nio4r (2.5.2)
|
89
|
-
nokogiri (1.10.
|
89
|
+
nokogiri (1.10.9)
|
90
90
|
mini_portile2 (~> 2.4.0)
|
91
|
-
rack (2.
|
91
|
+
rack (2.2.2)
|
92
92
|
rack-test (1.1.0)
|
93
93
|
rack (>= 1.0, < 3)
|
94
|
-
rails (6.0.
|
95
|
-
actioncable (= 6.0.
|
96
|
-
actionmailbox (= 6.0.
|
97
|
-
actionmailer (= 6.0.
|
98
|
-
actionpack (= 6.0.
|
99
|
-
actiontext (= 6.0.
|
100
|
-
actionview (= 6.0.
|
101
|
-
activejob (= 6.0.
|
102
|
-
activemodel (= 6.0.
|
103
|
-
activerecord (= 6.0.
|
104
|
-
activestorage (= 6.0.
|
105
|
-
activesupport (= 6.0.
|
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.
|
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.
|
115
|
-
actionpack (= 6.0.
|
116
|
-
activesupport (= 6.0.
|
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.
|
141
|
+
thor (1.0.1)
|
142
142
|
thread_safe (0.3.6)
|
143
|
-
tzinfo (1.2.
|
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.
|
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
|
|
data/lib/balrog/guard.rb
CHANGED
@@ -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[
|
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[
|
22
|
-
DateTime.current < @balrog_session[
|
21
|
+
return true unless @balrog_session[:expiry_date]
|
22
|
+
DateTime.current < @balrog_session[:expiry_date]
|
23
23
|
end
|
24
24
|
end
|
data/lib/balrog/version.rb
CHANGED
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.
|
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:
|
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: []
|