solidus_jwt 0.0.1.pre → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -1
- data/lib/solidus_jwt/concerns/encodeable.rb +1 -1
- data/lib/solidus_jwt/factories.rb +1 -1
- data/lib/solidus_jwt/version.rb +1 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 780275b1ea2a6b627290d2c6b5dd4d5f78e7d977
|
4
|
+
data.tar.gz: b04f13bd9c346d80af9d2da217d0de7728d1cdec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1830caa1c3ac263c4718178b6558eb9f8a1040330f2ad78d38a6cc2b9723d6b1932c8ad75890cae6a60b49b250b54174a8140b60718cdc8acb83ac04ad320c
|
7
|
+
data.tar.gz: ff34c666903253b254b6ff71590341d4cadae3086b490ee1391c80c7ed46188a7fad46b25531bcb255252019deb34602d8a37828a9678173f05809c7c105fdd2
|
data/README.md
CHANGED
@@ -26,7 +26,30 @@ bundle exec rails g solidus_jwt:install
|
|
26
26
|
|
27
27
|
Configuration
|
28
28
|
-------------
|
29
|
-
|
29
|
+
```ruby
|
30
|
+
SolidusJwt::Config.configure do |config|
|
31
|
+
config.jwt_secret = 'secret'
|
32
|
+
config.allow_spree_api_key = true
|
33
|
+
config.jwt_algorithm = 'HS256'
|
34
|
+
config.jwt_expiration = 3600
|
35
|
+
config.jwt_options = { only: %i[email first_name id last_name] }
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
#### `jwt_secret`:
|
40
|
+
Defaults to `Rails.application.secret_key_base`. The encryption key, should be kept secret and secure.
|
41
|
+
|
42
|
+
#### `allow_spree_api_key`:
|
43
|
+
Defaults to `true`. When true, the `spree_api_key` is still accepted as an authentication token along with json web tokens.
|
44
|
+
|
45
|
+
#### `jwt_algorithm`:
|
46
|
+
Defaults to `HS256`. See: https://github.com/jwt/ruby-jwt#algorithms-and-usage for more information on accepted algorithms.
|
47
|
+
|
48
|
+
#### `jwt_expiration`:
|
49
|
+
Defaults to `3600` (1 hour). The amount of time in seconds that the token should last for.
|
50
|
+
|
51
|
+
#### `jwt_options`
|
52
|
+
Defaults to `{ only: %i[email first_name id last_name] }`. These options are passed into `Spree::User#as_json` when serializing the token's payload. Keep in mind that the more information included, the larger the token will be. It may be in your best interest to keep it short and simple.
|
30
53
|
|
31
54
|
Usage
|
32
55
|
-------------
|
@@ -15,7 +15,7 @@ module SolidusJwt
|
|
15
15
|
extras['exp'] = Time.current.to_i + expires_in if expires_in.present?
|
16
16
|
extras['iat'] = Time.current
|
17
17
|
|
18
|
-
payload = extras.merge(payload)
|
18
|
+
payload = extras.merge(payload).as_json
|
19
19
|
JWT.encode(payload, SolidusJwt::Config.jwt_secret,
|
20
20
|
SolidusJwt::Config.jwt_algorithm)
|
21
21
|
end
|
data/lib/solidus_jwt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Scott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: byebug
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: capybara
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,6 +176,20 @@ dependencies:
|
|
162
176
|
- - ">="
|
163
177
|
- !ruby/object:Gem::Version
|
164
178
|
version: '0'
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: ffaker
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
165
193
|
- !ruby/object:Gem::Dependency
|
166
194
|
name: rspec-rails
|
167
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,12 +289,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
261
289
|
version: '0'
|
262
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
291
|
requirements:
|
264
|
-
- - "
|
292
|
+
- - ">="
|
265
293
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
294
|
+
version: '0'
|
267
295
|
requirements: []
|
268
296
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
297
|
+
rubygems_version: 2.6.13
|
270
298
|
signing_key:
|
271
299
|
specification_version: 4
|
272
300
|
summary: Add Json Web Tokens to Solidus API
|