jwt_api 0.1.3 → 0.1.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/README.md +11 -2
- data/jwt_api-0.1.3.gem +0 -0
- data/jwt_api.gemspec +1 -1
- data/lib/generators/jwt_api/templates/initializers/json_web_token.rb +1 -1
- data/lib/jwt_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7772f9c066af82798657d3761b4e2591a5d3bc9683983fe5f230bbd063c1d8d8
|
4
|
+
data.tar.gz: 0b7e3c073bd3480c48be3e7610b0d5bc25c75dfdcc1f22e17bade00fc50f9e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59bf83ec8f2afeea4a824a69783dad05f20ccea2895ae608574b391253b4a1b6d089ffb9ab2deeac95c87f623839998e55fdcf8fd63f76fce16c0f6384b4a91a
|
7
|
+
data.tar.gz: f8a201feaf0ea3c2a0443b4a6c6a50e8931f8b57c60fc57e2ae17d818e2d6ee19ff24a5d3646010df15520e55ffe5debeaf3610323df59dcfa6add06fee33481
|
data/README.md
CHANGED
@@ -56,8 +56,17 @@ Running via Spring preloader in process 56250
|
|
56
56
|
|
57
57
|
1. Make sure that each user that needs access to the API has a JTI generated.
|
58
58
|
1. `User.first.jti = SecureRandom.uuid`
|
59
|
-
2.
|
60
|
-
|
59
|
+
2. From your Rails console run `SecureRandom.hex(64)` and make note of the output.
|
60
|
+
- Sample output:
|
61
|
+
```text
|
62
|
+
"0086870fb04cafbaa15b110cf78352fbca75537cc90e06892e206e07c24caa33ff5f6aadf2649cafac08c4acf6a1b7527b97bfa943481c282ba2480a0a922657"
|
63
|
+
```
|
64
|
+
3. Run `rails credentials:edit --environment=development` (and production, staging when applicable) and set your `jwt_secret` environment variable.
|
65
|
+
```yml
|
66
|
+
jwt_secret: 0086870fb04cafbaa15b110cf78352fbca75537cc90e06892e206e07c24caa33ff5f6aadf2649cafac08c4acf6a1b7527b97bfa943481c282ba2480a0a922657
|
67
|
+
```
|
68
|
+
3. Request a JWT at the `/api/authenticate/` endpoint.
|
69
|
+
4. Include that token as a `Bearer` token in all other requests.
|
61
70
|
|
62
71
|
|
63
72
|
[](https://app.getpostman.com/run-collection/6130650-059cc2e3-88f7-48a8-95d0-d7dca1d7caef?action=collection%2Ffork&collection-url=entityId%3D6130650-059cc2e3-88f7-48a8-95d0-d7dca1d7caef%26entityType%3Dcollection%26workspaceId%3D128e0ba1-898b-40bb-8006-a329fb1c28de)
|
data/jwt_api-0.1.3.gem
ADDED
Binary file
|
data/jwt_api.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['lpolicastro@pm.me']
|
10
10
|
|
11
11
|
spec.summary = 'Scaffold a JSON Web Token API'
|
12
|
-
spec.description = 'Scaffold a JSON Web Token API'
|
12
|
+
spec.description = 'Scaffold a JSON Web Token API.'
|
13
13
|
spec.homepage = 'https://github.com/leopolicastro/jwt_api/'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = '>= 2.4.0'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# JSON Web Token class
|
4
4
|
class JsonWebToken
|
5
|
-
def initialize(key = Rails.application.credentials[:
|
5
|
+
def initialize(key = Rails.application.credentials[:jwt_secret], algorithm = 'HS256')
|
6
6
|
@key = key
|
7
7
|
@algorithm = algorithm
|
8
8
|
end
|
data/lib/jwt_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Policastro
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.2.3
|
33
|
-
description: Scaffold a JSON Web Token API
|
33
|
+
description: Scaffold a JSON Web Token API.
|
34
34
|
email:
|
35
35
|
- lpolicastro@pm.me
|
36
36
|
executables: []
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- bin/console
|
50
50
|
- bin/setup
|
51
51
|
- jwt_api-0.1.2.gem
|
52
|
+
- jwt_api-0.1.3.gem
|
52
53
|
- jwt_api.gemspec
|
53
54
|
- lib/generators/jwt_api/setup_generator.rb
|
54
55
|
- lib/generators/jwt_api/templates/api/base_controller.rb
|