grape_simple_auth 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -9
- data/lib/grape_simple_auth.rb +1 -0
- data/lib/grape_simple_auth/auth_methods/auth_methods.rb +28 -1
- data/lib/grape_simple_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: f47da796f0828ec0357808048ef324c1a84ffc6f57a19443e2e6f475a433592f
|
4
|
+
data.tar.gz: a8b89fe30828854bbcbc7b69c2b0521f1f7049ae5e0e4e1cc5db56863f3b53df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbe3ada101559255920abd3fb2407fd815ed24845ac38691847db99488a65ac9322f00308ac49bc950832c71d74ead749e5626f6d32aac8e6c26ffbab56f251
|
7
|
+
data.tar.gz: b42b148b85ca250b0dacda4e78800743fb98d52b1a71114eb70dadd7f48c59f118c20d79403f50ab02a2d58775c15a4d853d83cd6417f83d71b9b4adb69142d0
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape_simple_auth (0.1.
|
5
|
-
grape (~> 0)
|
6
|
-
httparty (~> 0)
|
4
|
+
grape_simple_auth (0.1.2)
|
5
|
+
grape (~> 1.1.0)
|
6
|
+
httparty (~> 0.16.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -25,17 +25,13 @@ GEM
|
|
25
25
|
thread_safe (~> 0.3, >= 0.3.1)
|
26
26
|
diff-lcs (1.3)
|
27
27
|
equalizer (0.0.11)
|
28
|
-
grape (
|
28
|
+
grape (1.1.0)
|
29
29
|
activesupport
|
30
30
|
builder
|
31
|
-
hashie (>= 2.1.0)
|
32
|
-
multi_json (>= 1.3.2)
|
33
|
-
multi_xml (>= 0.5.2)
|
34
31
|
mustermann-grape (~> 1.0.0)
|
35
32
|
rack (>= 1.3.0)
|
36
33
|
rack-accept
|
37
34
|
virtus (>= 1.0.0)
|
38
|
-
hashie (3.6.0)
|
39
35
|
httparty (0.16.3)
|
40
36
|
mime-types (~> 3.0)
|
41
37
|
multi_xml (>= 0.5.2)
|
@@ -46,7 +42,6 @@ GEM
|
|
46
42
|
mime-types-data (~> 3.2015)
|
47
43
|
mime-types-data (3.2018.0812)
|
48
44
|
minitest (5.11.3)
|
49
|
-
multi_json (1.13.1)
|
50
45
|
multi_xml (0.6.0)
|
51
46
|
mustermann (1.0.3)
|
52
47
|
mustermann-grape (1.0.0)
|
data/lib/grape_simple_auth.rb
CHANGED
@@ -22,6 +22,7 @@ module GrapeSimpleAuth
|
|
22
22
|
define_setting :url, "http://localhost:4000"
|
23
23
|
define_setting :verify_endpoint, "/v1/valid_token/verify"
|
24
24
|
define_setting :auth_strategy, "swagger"
|
25
|
+
define_setting :current_user_class, "User"
|
25
26
|
|
26
27
|
def self.verify_url
|
27
28
|
url + verify_endpoint
|
@@ -19,7 +19,7 @@ module GrapeSimpleAuth
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def current_user=(info)
|
22
|
-
@_current_user = JSON.parse(info.to_json, object_class:
|
22
|
+
@_current_user = JSON.parse(info.to_json, object_class: User)
|
23
23
|
end
|
24
24
|
|
25
25
|
def current_user
|
@@ -34,6 +34,33 @@ module GrapeSimpleAuth
|
|
34
34
|
@credentials
|
35
35
|
end
|
36
36
|
|
37
|
+
class User < OpenStruct
|
38
|
+
def as_json(*args)
|
39
|
+
super.as_json['table']
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.base_class
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.primary_key
|
47
|
+
"id"
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def self.name
|
52
|
+
GrapeSimpleAuth.current_user_class
|
53
|
+
end
|
54
|
+
|
55
|
+
def _read_attribute attr
|
56
|
+
self.send attr
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.polymorphic_name
|
60
|
+
GrapeSimpleAuth.current_user_class
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
37
64
|
class DataStruct < OpenStruct
|
38
65
|
def as_json(*args)
|
39
66
|
super.as_json['table']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_simple_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yunan Helmy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|