api_warden 0.2.0 → 0.3.0
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 +5 -5
- data/.github/workflows/ci.yml +28 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +165 -112
- data/README.md +43 -19
- data/api_warden.gemspec +5 -5
- data/lib/api_warden/authentication.rb +2 -2
- data/lib/api_warden/version.rb +1 -1
- metadata +15 -27
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fb14151c418b72224b050b406facd9de817d5408f00b24e792ed312294dbc772
|
|
4
|
+
data.tar.gz: 253eea6dc13f078aebccf86134eb8913e70410bfbdce1b018123054f0d5f6306
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 530023d4dbd736c0d075ab243a862aed389f96d915ecaa8a82be0702ebd9a0f38e92d9ebb7a18c989e8720acdfea1d0617d8b4499ded3c94074995fb80bdcf73
|
|
7
|
+
data.tar.gz: 4f63cfd3ad844364456c40acdd86ee87619242b852b0b04625516ecc5d38c0af3458f2de8135f3b9bdefd2a1bc5b1746b62546d1ffbf6c2b556c7f82e9ef34c9
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
main:
|
|
11
|
+
name: >-
|
|
12
|
+
${{ matrix.os }} ${{ matrix.ruby }}
|
|
13
|
+
runs-on: ${{ matrix.os }}-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu]
|
|
18
|
+
ruby: ['2.7', '3.0', 'head']
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v2
|
|
21
|
+
- name: Set up ruby
|
|
22
|
+
uses: ruby/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: bundle install
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: bundle exec rake spec
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.0.2
|
data/Gemfile
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
gem
|
|
7
|
+
gem 'rails', '~> 6.1.4'
|
|
8
|
+
|
|
9
|
+
gem 'rubocop', '~> 1.18', require: false
|
|
8
10
|
|
|
9
11
|
group :test do
|
|
10
12
|
gem 'rspec-rails', '~> 3.6'
|
|
11
|
-
end
|
|
13
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,148 +1,201 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
api_warden (0.
|
|
5
|
-
connection_pool (~> 2.2
|
|
6
|
-
redis (~>
|
|
4
|
+
api_warden (0.3.0)
|
|
5
|
+
connection_pool (~> 2.2)
|
|
6
|
+
redis (~> 4.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
|
|
12
|
-
actionpack (=
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
actioncable (6.1.4)
|
|
12
|
+
actionpack (= 6.1.4)
|
|
13
|
+
activesupport (= 6.1.4)
|
|
14
|
+
nio4r (~> 2.0)
|
|
15
|
+
websocket-driver (>= 0.6.1)
|
|
16
|
+
actionmailbox (6.1.4)
|
|
17
|
+
actionpack (= 6.1.4)
|
|
18
|
+
activejob (= 6.1.4)
|
|
19
|
+
activerecord (= 6.1.4)
|
|
20
|
+
activestorage (= 6.1.4)
|
|
21
|
+
activesupport (= 6.1.4)
|
|
22
|
+
mail (>= 2.7.1)
|
|
23
|
+
actionmailer (6.1.4)
|
|
24
|
+
actionpack (= 6.1.4)
|
|
25
|
+
actionview (= 6.1.4)
|
|
26
|
+
activejob (= 6.1.4)
|
|
27
|
+
activesupport (= 6.1.4)
|
|
15
28
|
mail (~> 2.5, >= 2.5.4)
|
|
16
|
-
rails-dom-testing (~>
|
|
17
|
-
actionpack (
|
|
18
|
-
actionview (=
|
|
19
|
-
activesupport (=
|
|
20
|
-
rack (~>
|
|
21
|
-
rack-test (
|
|
22
|
-
rails-dom-testing (~>
|
|
23
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
rails-dom-testing (~> 2.0)
|
|
30
|
+
actionpack (6.1.4)
|
|
31
|
+
actionview (= 6.1.4)
|
|
32
|
+
activesupport (= 6.1.4)
|
|
33
|
+
rack (~> 2.0, >= 2.0.9)
|
|
34
|
+
rack-test (>= 0.6.3)
|
|
35
|
+
rails-dom-testing (~> 2.0)
|
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
37
|
+
actiontext (6.1.4)
|
|
38
|
+
actionpack (= 6.1.4)
|
|
39
|
+
activerecord (= 6.1.4)
|
|
40
|
+
activestorage (= 6.1.4)
|
|
41
|
+
activesupport (= 6.1.4)
|
|
42
|
+
nokogiri (>= 1.8.5)
|
|
43
|
+
actionview (6.1.4)
|
|
44
|
+
activesupport (= 6.1.4)
|
|
26
45
|
builder (~> 3.1)
|
|
27
|
-
|
|
28
|
-
rails-dom-testing (~>
|
|
29
|
-
rails-html-sanitizer (~> 1.
|
|
30
|
-
activejob (
|
|
31
|
-
activesupport (=
|
|
32
|
-
globalid (>= 0.3.
|
|
33
|
-
activemodel (
|
|
34
|
-
activesupport (=
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
erubi (~> 1.4)
|
|
47
|
+
rails-dom-testing (~> 2.0)
|
|
48
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
49
|
+
activejob (6.1.4)
|
|
50
|
+
activesupport (= 6.1.4)
|
|
51
|
+
globalid (>= 0.3.6)
|
|
52
|
+
activemodel (6.1.4)
|
|
53
|
+
activesupport (= 6.1.4)
|
|
54
|
+
activerecord (6.1.4)
|
|
55
|
+
activemodel (= 6.1.4)
|
|
56
|
+
activesupport (= 6.1.4)
|
|
57
|
+
activestorage (6.1.4)
|
|
58
|
+
actionpack (= 6.1.4)
|
|
59
|
+
activejob (= 6.1.4)
|
|
60
|
+
activerecord (= 6.1.4)
|
|
61
|
+
activesupport (= 6.1.4)
|
|
62
|
+
marcel (~> 1.0.0)
|
|
63
|
+
mini_mime (>= 1.1.0)
|
|
64
|
+
activesupport (6.1.4)
|
|
65
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
66
|
+
i18n (>= 1.6, < 2)
|
|
67
|
+
minitest (>= 5.1)
|
|
68
|
+
tzinfo (~> 2.0)
|
|
69
|
+
zeitwerk (~> 2.3)
|
|
70
|
+
ast (2.4.2)
|
|
71
|
+
builder (3.2.4)
|
|
72
|
+
concurrent-ruby (1.1.9)
|
|
73
|
+
connection_pool (2.2.5)
|
|
74
|
+
crass (1.0.6)
|
|
75
|
+
diff-lcs (1.4.4)
|
|
76
|
+
erubi (1.10.0)
|
|
77
|
+
fakeredis (0.7.0)
|
|
78
|
+
redis (>= 3.2, < 5.0)
|
|
79
|
+
globalid (0.5.2)
|
|
80
|
+
activesupport (>= 5.0)
|
|
81
|
+
i18n (1.8.10)
|
|
57
82
|
concurrent-ruby (~> 1.0)
|
|
58
|
-
loofah (2.
|
|
83
|
+
loofah (2.11.0)
|
|
59
84
|
crass (~> 1.0.2)
|
|
60
85
|
nokogiri (>= 1.5.9)
|
|
61
|
-
mail (2.7.
|
|
86
|
+
mail (2.7.1)
|
|
62
87
|
mini_mime (>= 0.1.1)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
marcel (1.0.1)
|
|
89
|
+
method_source (1.0.0)
|
|
90
|
+
mini_mime (1.1.0)
|
|
91
|
+
minitest (5.14.4)
|
|
92
|
+
nio4r (2.5.8)
|
|
93
|
+
nokogiri (1.12.2-x86_64-darwin)
|
|
94
|
+
racc (~> 1.4)
|
|
95
|
+
parallel (1.20.1)
|
|
96
|
+
parser (3.0.2.0)
|
|
97
|
+
ast (~> 2.4.1)
|
|
98
|
+
racc (1.5.2)
|
|
99
|
+
rack (2.2.3)
|
|
100
|
+
rack-test (1.1.0)
|
|
101
|
+
rack (>= 1.0, < 3)
|
|
102
|
+
rails (6.1.4)
|
|
103
|
+
actioncable (= 6.1.4)
|
|
104
|
+
actionmailbox (= 6.1.4)
|
|
105
|
+
actionmailer (= 6.1.4)
|
|
106
|
+
actionpack (= 6.1.4)
|
|
107
|
+
actiontext (= 6.1.4)
|
|
108
|
+
actionview (= 6.1.4)
|
|
109
|
+
activejob (= 6.1.4)
|
|
110
|
+
activemodel (= 6.1.4)
|
|
111
|
+
activerecord (= 6.1.4)
|
|
112
|
+
activestorage (= 6.1.4)
|
|
113
|
+
activesupport (= 6.1.4)
|
|
114
|
+
bundler (>= 1.15.0)
|
|
115
|
+
railties (= 6.1.4)
|
|
116
|
+
sprockets-rails (>= 2.0.0)
|
|
117
|
+
rails-dom-testing (2.0.3)
|
|
118
|
+
activesupport (>= 4.2.0)
|
|
119
|
+
nokogiri (>= 1.6)
|
|
120
|
+
rails-html-sanitizer (1.3.0)
|
|
121
|
+
loofah (~> 2.3)
|
|
122
|
+
railties (6.1.4)
|
|
123
|
+
actionpack (= 6.1.4)
|
|
124
|
+
activesupport (= 6.1.4)
|
|
125
|
+
method_source
|
|
126
|
+
rake (>= 0.13)
|
|
127
|
+
thor (~> 1.0)
|
|
128
|
+
rainbow (3.0.0)
|
|
129
|
+
rake (13.0.6)
|
|
130
|
+
redis (4.4.0)
|
|
131
|
+
redis-namespace (1.8.1)
|
|
98
132
|
redis (>= 3.0.4)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
rspec-
|
|
103
|
-
|
|
104
|
-
rspec-
|
|
105
|
-
rspec-
|
|
133
|
+
regexp_parser (2.1.1)
|
|
134
|
+
rexml (3.2.5)
|
|
135
|
+
rspec (3.9.0)
|
|
136
|
+
rspec-core (~> 3.9.0)
|
|
137
|
+
rspec-expectations (~> 3.9.0)
|
|
138
|
+
rspec-mocks (~> 3.9.0)
|
|
139
|
+
rspec-core (3.9.3)
|
|
140
|
+
rspec-support (~> 3.9.3)
|
|
141
|
+
rspec-expectations (3.9.4)
|
|
106
142
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
107
|
-
rspec-support (~> 3.
|
|
108
|
-
rspec-json_expectations (2.
|
|
109
|
-
rspec-mocks (3.
|
|
143
|
+
rspec-support (~> 3.9.0)
|
|
144
|
+
rspec-json_expectations (2.2.0)
|
|
145
|
+
rspec-mocks (3.9.1)
|
|
110
146
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
111
|
-
rspec-support (~> 3.
|
|
112
|
-
rspec-rails (3.
|
|
147
|
+
rspec-support (~> 3.9.0)
|
|
148
|
+
rspec-rails (3.9.1)
|
|
113
149
|
actionpack (>= 3.0)
|
|
114
150
|
activesupport (>= 3.0)
|
|
115
151
|
railties (>= 3.0)
|
|
116
|
-
rspec-core (~> 3.
|
|
117
|
-
rspec-expectations (~> 3.
|
|
118
|
-
rspec-mocks (~> 3.
|
|
119
|
-
rspec-support (~> 3.
|
|
120
|
-
rspec-support (3.
|
|
121
|
-
|
|
152
|
+
rspec-core (~> 3.9.0)
|
|
153
|
+
rspec-expectations (~> 3.9.0)
|
|
154
|
+
rspec-mocks (~> 3.9.0)
|
|
155
|
+
rspec-support (~> 3.9.0)
|
|
156
|
+
rspec-support (3.9.4)
|
|
157
|
+
rubocop (1.18.4)
|
|
158
|
+
parallel (~> 1.10)
|
|
159
|
+
parser (>= 3.0.0.0)
|
|
160
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
161
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
162
|
+
rexml
|
|
163
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
|
164
|
+
ruby-progressbar (~> 1.7)
|
|
165
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
166
|
+
rubocop-ast (1.9.0)
|
|
167
|
+
parser (>= 3.0.1.1)
|
|
168
|
+
ruby-progressbar (1.11.0)
|
|
169
|
+
sprockets (4.0.2)
|
|
122
170
|
concurrent-ruby (~> 1.0)
|
|
123
171
|
rack (> 1, < 3)
|
|
124
|
-
sprockets-rails (3.2.
|
|
172
|
+
sprockets-rails (3.2.2)
|
|
125
173
|
actionpack (>= 4.0)
|
|
126
174
|
activesupport (>= 4.0)
|
|
127
175
|
sprockets (>= 3.0.0)
|
|
128
|
-
thor (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
176
|
+
thor (1.1.0)
|
|
177
|
+
tzinfo (2.0.4)
|
|
178
|
+
concurrent-ruby (~> 1.0)
|
|
179
|
+
unicode-display_width (2.0.0)
|
|
180
|
+
websocket-driver (0.7.5)
|
|
181
|
+
websocket-extensions (>= 0.1.0)
|
|
182
|
+
websocket-extensions (0.1.5)
|
|
183
|
+
zeitwerk (2.4.2)
|
|
132
184
|
|
|
133
185
|
PLATFORMS
|
|
134
|
-
|
|
186
|
+
x86_64-darwin-20
|
|
135
187
|
|
|
136
188
|
DEPENDENCIES
|
|
137
189
|
api_warden!
|
|
138
|
-
bundler (~>
|
|
190
|
+
bundler (~> 2.2)
|
|
139
191
|
fakeredis
|
|
140
|
-
rails (
|
|
141
|
-
rake (~>
|
|
192
|
+
rails (~> 6.1.4)
|
|
193
|
+
rake (~> 13.0)
|
|
142
194
|
redis-namespace (~> 1.5, >= 1.5.2)
|
|
143
195
|
rspec (~> 3.0)
|
|
144
196
|
rspec-json_expectations
|
|
145
197
|
rspec-rails (~> 3.6)
|
|
198
|
+
rubocop (~> 1.18)
|
|
146
199
|
|
|
147
200
|
BUNDLED WITH
|
|
148
|
-
|
|
201
|
+
2.2.25
|
data/README.md
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# api_warden
|
|
2
2
|
|
|
3
|
-
This is a gem that you can use to protect your API in rails. By default it uses
|
|
3
|
+
This is a gem that you can use to protect your API in rails. By default it uses
|
|
4
|
+
access token to authenticate the requests, and uses refresh token to get new
|
|
5
|
+
access token before access token expires.
|
|
4
6
|
|
|
5
|
-
##
|
|
7
|
+
## Usage
|
|
6
8
|
|
|
7
|
-
https://github.com/
|
|
9
|
+
See [here](https://github.com/uzxmx/api_warden_examples) for a working example
|
|
10
|
+
project.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
* Add the gem to your application's Gemfile. And execute `bundle install`.
|
|
10
13
|
|
|
11
|
-
* Add the gem to your application's Gemfile. And execute `bundle install`
|
|
12
14
|
```
|
|
13
15
|
gem 'api_warden'
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
* Create
|
|
18
|
+
* Create file `config/initializers/api_warden.rb`. And add the below codes.
|
|
19
|
+
|
|
17
20
|
```
|
|
18
21
|
ApiWarden.configure do |config|
|
|
19
22
|
config.redis = {
|
|
@@ -26,14 +29,16 @@ end
|
|
|
26
29
|
ApiWarden.ward_by('users')
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
* Create app/controllers/base_controller.rb
|
|
32
|
+
* Create file `app/controllers/base_controller.rb`. And add the below codes.
|
|
33
|
+
|
|
30
34
|
```
|
|
31
|
-
class BaseController < ActionController::
|
|
35
|
+
class BaseController < ActionController::API
|
|
32
36
|
before_action :ward_by_user!
|
|
33
37
|
end
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
* Create app/controllers/users_controller.rb
|
|
40
|
+
* Create file `app/controllers/users_controller.rb`. And add the below codes.
|
|
41
|
+
|
|
37
42
|
```
|
|
38
43
|
class UsersController < BaseController
|
|
39
44
|
skip_before_action :ward_by_user!, only: [:sign_in]
|
|
@@ -50,13 +55,16 @@ class UsersController < BaseController
|
|
|
50
55
|
end
|
|
51
56
|
```
|
|
52
57
|
|
|
53
|
-
*
|
|
58
|
+
* On client side, you need to specify below http headers to access the server protected resources.
|
|
59
|
+
|
|
54
60
|
```
|
|
55
61
|
X-User-Id: <the user id rendered in sign in api>
|
|
56
62
|
X-User-Access-Token: <the access token rendered in sign in api>
|
|
57
63
|
```
|
|
58
64
|
|
|
59
|
-
* If the access token expires, you
|
|
65
|
+
* If the access token expires, you can use the refresh token to get a new
|
|
66
|
+
pair of access and refresh token. Update `users_controller.rb` as below.
|
|
67
|
+
|
|
60
68
|
```
|
|
61
69
|
class UsersController < BaseController
|
|
62
70
|
skip_before_action :ward_by_user!, only: [:sign_in, :refresh_token]
|
|
@@ -79,13 +87,14 @@ class UsersController < BaseController
|
|
|
79
87
|
user_id: user_id,
|
|
80
88
|
access_token: access_token,
|
|
81
89
|
refresh_token: refresh_token
|
|
82
|
-
}
|
|
83
|
-
end
|
|
90
|
+
}
|
|
91
|
+
end
|
|
84
92
|
end
|
|
85
93
|
end
|
|
86
94
|
```
|
|
87
95
|
|
|
88
|
-
*
|
|
96
|
+
* On client side, when requesting the refresh token api, you need to specify below http headers.
|
|
97
|
+
|
|
89
98
|
```
|
|
90
99
|
X-User-Id: <the user id rendered in sign in api>
|
|
91
100
|
X-User-Refresh-Token: <the refresh token rendered in sign in api>
|
|
@@ -93,13 +102,28 @@ X-User-Refresh-Token: <the refresh token rendered in sign in api>
|
|
|
93
102
|
|
|
94
103
|
## Development
|
|
95
104
|
|
|
96
|
-
|
|
105
|
+
### Install dependencies
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
bundle install
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Run tests
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
bundle exec rake spec
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Release a new version
|
|
97
118
|
|
|
98
|
-
To
|
|
119
|
+
To release a new version, update the version number in `version.rb`, and then
|
|
120
|
+
run `bundle exec rake release`, which will create a git tag for the version,
|
|
121
|
+
push git commits and tags, and push the `.gem` file to
|
|
122
|
+
[rubygems.org](https://rubygems.org).
|
|
99
123
|
|
|
100
124
|
## Contributing
|
|
101
125
|
|
|
102
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
126
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/uzxmx/api_warden. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
103
127
|
|
|
104
128
|
## License
|
|
105
129
|
|
|
@@ -107,4 +131,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
107
131
|
|
|
108
132
|
## Code of Conduct
|
|
109
133
|
|
|
110
|
-
Everyone interacting in the
|
|
134
|
+
Everyone interacting in the api_warden project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/uzxmx/api_warden/blob/master/CODE_OF_CONDUCT.md).
|
data/api_warden.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
|
|
11
11
|
spec.summary = 'Use access token to protect your API in rails.'
|
|
12
12
|
spec.description = 'Use access token to protect your API in rails.'
|
|
13
|
-
spec.homepage = 'https://github.com/
|
|
13
|
+
spec.homepage = 'https://github.com/uzxmx/api_warden'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
15
|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
end
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
spec.add_dependency 'redis', '~>
|
|
22
|
-
spec.add_dependency 'connection_pool', '~> 2.2'
|
|
21
|
+
spec.add_dependency 'redis', '~> 4.0'
|
|
22
|
+
spec.add_dependency 'connection_pool', '~> 2.2'
|
|
23
23
|
|
|
24
24
|
spec.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2'
|
|
25
25
|
spec.add_development_dependency 'fakeredis'
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
29
29
|
spec.add_development_dependency 'rspec-json_expectations'
|
|
30
30
|
end
|
|
@@ -60,7 +60,7 @@ module ApiWarden
|
|
|
60
60
|
|
|
61
61
|
unless @value_for_access_token
|
|
62
62
|
@authenticated = false
|
|
63
|
-
raise AuthenticationError
|
|
63
|
+
raise AuthenticationError
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
@authenticated = true
|
|
@@ -94,7 +94,7 @@ module ApiWarden
|
|
|
94
94
|
|
|
95
95
|
@refreshable = true
|
|
96
96
|
@id = id
|
|
97
|
-
self
|
|
97
|
+
self
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
# TODO remove refresh token as well
|
data/lib/api_warden/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api_warden
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mingxiang Xue
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: redis
|
|
@@ -16,20 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 3.2.1
|
|
19
|
+
version: '4.0'
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
24
|
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 3.2.1
|
|
26
|
+
version: '4.0'
|
|
33
27
|
- !ruby/object:Gem::Dependency
|
|
34
28
|
name: connection_pool
|
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -37,9 +31,6 @@ dependencies:
|
|
|
37
31
|
- - "~>"
|
|
38
32
|
- !ruby/object:Gem::Version
|
|
39
33
|
version: '2.2'
|
|
40
|
-
- - ">="
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: 2.2.0
|
|
43
34
|
type: :runtime
|
|
44
35
|
prerelease: false
|
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -47,9 +38,6 @@ dependencies:
|
|
|
47
38
|
- - "~>"
|
|
48
39
|
- !ruby/object:Gem::Version
|
|
49
40
|
version: '2.2'
|
|
50
|
-
- - ">="
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: 2.2.0
|
|
53
41
|
- !ruby/object:Gem::Dependency
|
|
54
42
|
name: redis-namespace
|
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -90,28 +78,28 @@ dependencies:
|
|
|
90
78
|
requirements:
|
|
91
79
|
- - "~>"
|
|
92
80
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: '
|
|
81
|
+
version: '2.2'
|
|
94
82
|
type: :development
|
|
95
83
|
prerelease: false
|
|
96
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
97
85
|
requirements:
|
|
98
86
|
- - "~>"
|
|
99
87
|
- !ruby/object:Gem::Version
|
|
100
|
-
version: '
|
|
88
|
+
version: '2.2'
|
|
101
89
|
- !ruby/object:Gem::Dependency
|
|
102
90
|
name: rake
|
|
103
91
|
requirement: !ruby/object:Gem::Requirement
|
|
104
92
|
requirements:
|
|
105
93
|
- - "~>"
|
|
106
94
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '
|
|
95
|
+
version: '13.0'
|
|
108
96
|
type: :development
|
|
109
97
|
prerelease: false
|
|
110
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
111
99
|
requirements:
|
|
112
100
|
- - "~>"
|
|
113
101
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: '
|
|
102
|
+
version: '13.0'
|
|
115
103
|
- !ruby/object:Gem::Dependency
|
|
116
104
|
name: rspec
|
|
117
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -147,9 +135,10 @@ executables: []
|
|
|
147
135
|
extensions: []
|
|
148
136
|
extra_rdoc_files: []
|
|
149
137
|
files:
|
|
138
|
+
- ".github/workflows/ci.yml"
|
|
150
139
|
- ".gitignore"
|
|
151
140
|
- ".rspec"
|
|
152
|
-
- ".
|
|
141
|
+
- ".ruby-version"
|
|
153
142
|
- CODE_OF_CONDUCT.md
|
|
154
143
|
- Gemfile
|
|
155
144
|
- Gemfile.lock
|
|
@@ -169,11 +158,11 @@ files:
|
|
|
169
158
|
- lib/api_warden/redis_connection.rb
|
|
170
159
|
- lib/api_warden/scope.rb
|
|
171
160
|
- lib/api_warden/version.rb
|
|
172
|
-
homepage: https://github.com/
|
|
161
|
+
homepage: https://github.com/uzxmx/api_warden
|
|
173
162
|
licenses:
|
|
174
163
|
- MIT
|
|
175
164
|
metadata: {}
|
|
176
|
-
post_install_message:
|
|
165
|
+
post_install_message:
|
|
177
166
|
rdoc_options: []
|
|
178
167
|
require_paths:
|
|
179
168
|
- lib
|
|
@@ -188,9 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
188
177
|
- !ruby/object:Gem::Version
|
|
189
178
|
version: '0'
|
|
190
179
|
requirements: []
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
signing_key:
|
|
180
|
+
rubygems_version: 3.2.22
|
|
181
|
+
signing_key:
|
|
194
182
|
specification_version: 4
|
|
195
183
|
summary: Use access token to protect your API in rails.
|
|
196
184
|
test_files: []
|