jwt-rest 0.1.1 → 0.1.2
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 +3 -4
- data/lib/jwt_rest/auth_header.rb +1 -1
- data/lib/jwt_rest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e601954d716c75280a697f162b16dadac221a0f
|
|
4
|
+
data.tar.gz: a8664f62307935699ca89e55ac7e27e946fcd24a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 601928a04163f61d6f1188454291267db847bee304fd5809a601b9f24e1c44e7a28ce1df237dc8c060ea2f5add4861847f954eb5372ee4412fe6d2ebe2bcbf38
|
|
7
|
+
data.tar.gz: 5db9906d04719b5578e2e5a7781796540c99e2b95c1a16b1542357d768ef6bfcf07d429da0bc8bca3b9e97c7f0adf28f553ed35ad0c443dd0194a118204b6f28
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ bundle
|
|
|
16
16
|
|
|
17
17
|
First you will need to provide a way to find if the ApiKey is valid or not, and a way to retrieve the RSA private key to sign JWT tokens. For this, lets create a initializer `config/initializers/jwt_rest.rb`.
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```ruby
|
|
20
20
|
require "jwt_rest"
|
|
21
21
|
|
|
22
22
|
module JwtRest
|
|
@@ -34,11 +34,10 @@ end
|
|
|
34
34
|
|
|
35
35
|
Then in your API's base controller do this
|
|
36
36
|
|
|
37
|
-
```
|
|
37
|
+
```ruby
|
|
38
38
|
class ApiController < ActionController::API
|
|
39
39
|
include JwtRest::Authenticable
|
|
40
40
|
|
|
41
|
-
before_action :demand_application_json
|
|
42
41
|
before_action :demand_api_key
|
|
43
42
|
|
|
44
43
|
def handle_user_identity(jwt_payload)
|
|
@@ -51,7 +50,7 @@ end
|
|
|
51
50
|
This will ensure that every call to your API i
|
|
52
51
|
s made with a valid api key. You could use the method `demand_current_user` for those endpoins where you need to authenticate the user with the JWT token.
|
|
53
52
|
|
|
54
|
-
```
|
|
53
|
+
```ruby
|
|
55
54
|
class UsersController < ApiController
|
|
56
55
|
before_action :demand_current_user, only: [:profile]
|
|
57
56
|
|
data/lib/jwt_rest/auth_header.rb
CHANGED
data/lib/jwt_rest/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jwt-rest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mariowise
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|