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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2236e6e97f3f4edb359ad86ba0ea5efe092b370756ff4534eec9ef75535b5209
4
- data.tar.gz: 4b311aadb65a2816b3b5947916df457e092dd947677bbaa8683240c864e6dd66
3
+ metadata.gz: 7772f9c066af82798657d3761b4e2591a5d3bc9683983fe5f230bbd063c1d8d8
4
+ data.tar.gz: 0b7e3c073bd3480c48be3e7610b0d5bc25c75dfdcc1f22e17bade00fc50f9e47
5
5
  SHA512:
6
- metadata.gz: 505253a7de5e59e0e9c5372c269e24e2f528081d1efcd72b423a8499e2f91ed404c81549921a25f710e52fac1d86f9be1d9b3891332661636d8d42cd726f78be
7
- data.tar.gz: a8a9ea38d901d381be290d68de1320e736c4ea5b0a7d8f7a2ed8da2f363cd63370a62717c16583247fc440202eaed7a7ff00d982c50ff77c22c72a95d03e0a89
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. Request a JWT at the `/api/authenticate/` endpoint.
60
- 3. Include that token as a `Bearer` token in all other requests.
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
  [![Run in Postman](https://run.pstmn.io/button.svg)](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[:secret_key_base], algorithm = 'HS256')
5
+ def initialize(key = Rails.application.credentials[:jwt_secret], algorithm = 'HS256')
6
6
  @key = key
7
7
  @algorithm = algorithm
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JwtApi
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
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.3
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