jm81auth 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jm81auth/models/auth_method.rb +3 -3
- data/lib/jm81auth/models/auth_token.rb +5 -1
- data/lib/jm81auth/models/user.rb +5 -1
- data/lib/jm81auth/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: 0c3c59397d88dbdf28d7e4d648d31add2778816b
|
4
|
+
data.tar.gz: 5f9c327cf43476a2461cb2fbbd2143f60e1e6260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd400241266aabd44738a03ebb93a7ca7d5b56e618bfad3ea44241acd8a8cf47a0cf621095a05c71c81f372f079a955757012d3fdce58094b12bb7a3dd51c890
|
7
|
+
data.tar.gz: 3032d568c94dffae893cb2d17148f4ba5c7ff29a114ed4cc38b37dcc1637aea071bc5d98af16cc38ff20b4c631926766889672efacd87a5c556346694951b0a5
|
@@ -19,10 +19,10 @@ module Jm81auth
|
|
19
19
|
#
|
20
20
|
# @return [AuthToken]
|
21
21
|
def create_token
|
22
|
-
if respond_to? :
|
23
|
-
auth_tokens.create! user: user, last_used_at: Time.now.utc
|
24
|
-
else
|
22
|
+
if self.respond_to? :add_auth_token
|
25
23
|
add_auth_token user: user, last_used_at: Time.now.utc
|
24
|
+
else
|
25
|
+
auth_tokens.create! user: user, last_used_at: Time.now.utc
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -65,7 +65,11 @@ module Jm81auth
|
|
65
65
|
token, config.jwt_secret, config.jwt_algorithm
|
66
66
|
).first
|
67
67
|
|
68
|
-
|
68
|
+
if self.respond_to? :[]
|
69
|
+
auth_token = self[payload['auth_token_id']]
|
70
|
+
else
|
71
|
+
auth_token = find payload['auth_token_id']
|
72
|
+
end
|
69
73
|
|
70
74
|
if payload['auth_token_id'].nil?
|
71
75
|
raise DecodeError, "auth_token_id missing: #{payload}"
|
data/lib/jm81auth/models/user.rb
CHANGED
@@ -50,7 +50,11 @@ module Jm81auth
|
|
50
50
|
display_name: oauth.display_name
|
51
51
|
)
|
52
52
|
|
53
|
-
|
53
|
+
if user.respond_to? :add_auth_method
|
54
|
+
method = user.add_auth_method oauth.provider_data
|
55
|
+
else
|
56
|
+
method = user.auth_methods.create! oauth.provider_data
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
method.create_token
|
data/lib/jm81auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jm81auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|