token_authenticate_me 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/app/mailers/token_authenticate_me_mailer.rb +2 -2
- data/lib/generators/token_authenticate_me/controllers/controllers_generator.rb +13 -0
- data/lib/generators/token_authenticate_me/controllers/templates/users.rb +8 -0
- data/lib/generators/token_authenticate_me/install/install_generator.rb +3 -0
- data/lib/token_authenticate_me/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab1f69037ef25abac0ffb29692fb344673d8d390
|
4
|
+
data.tar.gz: 1a8b7bd247a123c0c6c2ab56d0473cc9bdf3118e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212c64338401ef20c70bc4e232d3de75ccf081dbf91de65725245fbee6e5a9ddf65e412c1e6f8404ef5c62c1d72a18dc9ab53f223fb48f8606d8ff3964ef6c3d
|
7
|
+
data.tar.gz: 0825e8e45fc23ccaaf0eac9436aa870c11e83f3dd679497207588b0a31e5ba0266a396457a6aa0e227e35efeadc94f9e0119fe02c384d422309d40e50d08aa29
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Replace `<model>` with the class name used for users. This will create the neces
|
|
19
19
|
|
20
20
|
Include TokenAuthenticateMe::TokenAuthentication into the application controller or any controllers that require authorization:
|
21
21
|
````rb
|
22
|
-
require 'token_authenticate_me/
|
22
|
+
require 'token_authenticate_me/controllers/token_authenticateable'
|
23
23
|
|
24
24
|
class ApplicationController < ActionController::Base
|
25
25
|
force_ssl if Rails.env.production?
|
@@ -28,7 +28,7 @@ class ApplicationController < ActionController::Base
|
|
28
28
|
# For APIs, you may want to use :null_session instead.
|
29
29
|
protect_from_forgery with: :exception
|
30
30
|
|
31
|
-
include TokenAuthenticateMe::
|
31
|
+
include TokenAuthenticateMe::Controllers::TokenAuthenticateable
|
32
32
|
|
33
33
|
#...
|
34
34
|
end
|
@@ -43,5 +43,6 @@ class Api::V1::UsersController < Api::BaseController
|
|
43
43
|
end
|
44
44
|
````
|
45
45
|
|
46
|
-
|
47
|
-
[ ]
|
46
|
+
#### TODO:
|
47
|
+
- [ ] Make it so any resource name can be used for authentication (initial thought is either specify the default or pass resource name in token string?).
|
48
|
+
- [ ] Allow users to specify the API namespace default.
|
@@ -29,6 +29,19 @@ namespace :api do
|
|
29
29
|
id: TokenAuthenticateMe::UUID_REGEX
|
30
30
|
}
|
31
31
|
)
|
32
|
+
end
|
33
|
+
ROUTE
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_users_controller
|
37
|
+
template 'users.rb', 'app/controllers/api/users_controller.rb'
|
38
|
+
|
39
|
+
# Inject /api/v1/users route into routes file
|
40
|
+
route <<-ROUTE
|
41
|
+
namespace :api do
|
42
|
+
namespace :v1 do
|
43
|
+
resources :users
|
44
|
+
end
|
32
45
|
end
|
33
46
|
ROUTE
|
34
47
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'token_authenticate_me/controllers/token_authenticateable'
|
2
|
+
|
3
|
+
class Api::V1::UsersController < ApplicationController
|
4
|
+
include ApiMe
|
5
|
+
include TokenAuthenticateMe::Controllers::TokenAuthenticateable
|
6
|
+
|
7
|
+
skip_before_action :authenticate, only: [:create]
|
8
|
+
end
|
@@ -6,6 +6,9 @@ module TokenAuthenticateMe
|
|
6
6
|
|
7
7
|
invoke 'token_authenticate_me:models', params
|
8
8
|
invoke 'token_authenticate_me:controllers', params
|
9
|
+
invoke 'api_me:policy', ['user', 'username', 'email', 'password', 'password_confirmation']
|
10
|
+
invoke 'api_me:filter', ['user']
|
11
|
+
invoke 'serializer', ['user', 'username', 'email', 'created_at', 'updated_at']
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: token_authenticate_me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Clopton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- lib/generators/token_authenticate_me/controllers/controllers_generator.rb
|
188
188
|
- lib/generators/token_authenticate_me/controllers/templates/password_reset.rb
|
189
189
|
- lib/generators/token_authenticate_me/controllers/templates/sessions.rb
|
190
|
+
- lib/generators/token_authenticate_me/controllers/templates/users.rb
|
190
191
|
- lib/generators/token_authenticate_me/install/install_generator.rb
|
191
192
|
- lib/generators/token_authenticate_me/models/models_generator.rb
|
192
193
|
- lib/generators/token_authenticate_me/models/templates/authentication_migration.rb
|