touth 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/touth.rb +16 -0
- data/lib/touth/action_controller_support.rb +2 -7
- data/lib/touth/active_record_support.rb +0 -4
- data/lib/touth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 469a3737bb35a3a5c9b14d4af257e0a2c7d2e0f6
|
4
|
+
data.tar.gz: 630d22bfbd1c42c70a376555826ec1e4aac5a585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb8ea431513911ee94fa8df7997bf333b79dad68da0a3819fc5494981584693a2278c4f1600bc84e2d6043c4bb8d9ca91782b2b5b3011b25729fbfef79d30ae
|
7
|
+
data.tar.gz: ca035808f9b2fc84027c6a5fde3cbcbbf8ac2bf7937c3951cac4672184966b4d4057166955ff3bf267f23d0e73d0556fc4dd96983416f65c721e93ddb336d2fa
|
data/lib/touth.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
|
3
3
|
|
4
|
+
# Touth
|
5
|
+
#-----------------------------------------------
|
4
6
|
module Touth
|
5
7
|
|
6
8
|
extend ActiveSupport::Autoload
|
@@ -54,4 +56,18 @@ module Touth
|
|
54
56
|
|
55
57
|
end
|
56
58
|
|
59
|
+
|
60
|
+
# Setup
|
61
|
+
#-----------------------------------------------
|
57
62
|
Touth.setup
|
63
|
+
|
64
|
+
|
65
|
+
# Load
|
66
|
+
#-----------------------------------------------
|
67
|
+
ActiveSupport.on_load(:action_controller) do
|
68
|
+
extend Touth::ActionControllerSupport::ClassMethods
|
69
|
+
include Touth::ActionControllerSupport::InstanceMethods
|
70
|
+
end
|
71
|
+
ActiveSupport.on_load(:active_record) do
|
72
|
+
extend Touth::ActiveRecordSupport::ClassMethods
|
73
|
+
end
|
@@ -31,20 +31,15 @@ module Touth
|
|
31
31
|
def authenticate_token!
|
32
32
|
token = request.headers[Touth.header_name]
|
33
33
|
|
34
|
-
|
34
|
+
unless token && Authenticator.valid_access_token?(token)
|
35
35
|
render nothing: true, status: :unauthorized
|
36
36
|
return false
|
37
37
|
end
|
38
38
|
|
39
39
|
model = Authenticator.get_model token
|
40
|
-
self.class.access_token_resources[model.name] = model
|
40
|
+
self.class.access_token_resources[model.class.name] = model
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
47
|
-
ActiveSupport.on_load(:action_controller) do
|
48
|
-
extend Touth::ActionControllerSupport::ClassMethods
|
49
|
-
include Touth::ActionControllerSupport::InstanceMethods
|
50
|
-
end
|
data/lib/touth/version.rb
CHANGED