model_token_auth 1.0.2 → 1.0.3
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 +19 -4
- data/lib/model_token_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a3527ddbe35d5c795b9d4de1d5a07f1f7e42dd24c3b65511ad9a481de22a4a6
|
4
|
+
data.tar.gz: f2c38cf208b737e3f79a3ee65ce4f6df542778c55f7baba2886465be6f38c3a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 824f224bc51be881696672ce094905916b60d05246445627baaaee9ba86b1474e997f98693b4e04ae34ccc984d2962bb5f942d6ca06bf749d961e22602e7c24f
|
7
|
+
data.tar.gz: 40037a69c81623ba04223a4826a5adc929d4e528f4892108c599b7575bac0e3036e3862555a6f287b0d8288dcf83ef899a1901837763e09ebc4f22cdfb98ec7f
|
data/README.md
CHANGED
@@ -6,15 +6,16 @@ Generates tokens in models and authentication in the controllers.
|
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
-
This plugin handles Token
|
9
|
+
This plugin handles Token authentication for models. In models in which
|
10
10
|
`#acts_as_model_authenticable` method is called, the instances will be able generating
|
11
11
|
a token by calling the methods `#save`, `#create` and `#create!`of ActiveRecord. The
|
12
12
|
token is generated in an associated model called AccessToken.
|
13
13
|
|
14
14
|
The plugin also handles authentication in the controllers by inserting a generic
|
15
15
|
`#authenticate!` method in ActionController::Base or ActionController::API that
|
16
|
-
will verify the existence of the token and creates the `current_*` method
|
17
|
-
|
16
|
+
will verify the existence of the token and creates the `current_*` method.
|
17
|
+
|
18
|
+
To authenticate some token it'll need adding the header `X-Auth-Token` in the request with a token as a value.
|
18
19
|
|
19
20
|
### Models
|
20
21
|
|
@@ -96,12 +97,26 @@ Add this line to your application's Gemfile:
|
|
96
97
|
gem 'model_token_auth'
|
97
98
|
```
|
98
99
|
|
99
|
-
|
100
|
+
Then execute:
|
100
101
|
|
101
102
|
```bash
|
102
103
|
$ bundle
|
103
104
|
```
|
104
105
|
|
106
|
+
In your project directory:
|
107
|
+
|
108
|
+
```bash
|
109
|
+
$ rails generate access_token
|
110
|
+
```
|
111
|
+
|
112
|
+
This will generate a migration, then:
|
113
|
+
|
114
|
+
```bash
|
115
|
+
$ rake db:migrate
|
116
|
+
```
|
117
|
+
|
118
|
+
Once the migration finishes, the models will be ready to be authenticated.
|
119
|
+
|
105
120
|
## Contributing
|
106
121
|
|
107
122
|
Bug report or pull request are welcome.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_token_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armando Alejandre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|