capcoauth 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capcoauth/oauth/token_verifier.rb +4 -1
- data/lib/capcoauth/rails/helpers.rb +4 -4
- data/lib/capcoauth/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: 8ec44b77288ba8927780f0b45b3cb545d5268582
|
4
|
+
data.tar.gz: 57c2652a7fc0dc729d92496d82ccf3abf4aedac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44933c8af8c9e94741dedbcb67577e6e06f2028134590be3b79f9915fbaa8907310dc4d70313758552232c2f8d5aaa801131b546b30af782b7739610a7c73ffa
|
7
|
+
data.tar.gz: 10206151a2418737ddac3147bfceba635237d30452bec9310b6793db2f463a1801962b4e7d0e193e72d1c5c34d682e203473d4186681e92b99841feabd68f43e
|
@@ -21,6 +21,9 @@ module Capcoauth
|
|
21
21
|
# Set the user_id from the token response
|
22
22
|
if response.code == 200
|
23
23
|
|
24
|
+
# Detect application credentials
|
25
|
+
application_credentials = response.parsed_response['resource_owner_id'].blank?
|
26
|
+
|
24
27
|
# Get the proper ID value field from the response
|
25
28
|
user_id_field = Capcoauth.configuration.user_id_field
|
26
29
|
if user_id_field == :capcoauth
|
@@ -30,7 +33,7 @@ module Capcoauth
|
|
30
33
|
end
|
31
34
|
|
32
35
|
# Throw unauthorized if ID of specified type doesn't exist
|
33
|
-
|
36
|
+
if access_token.user_id.blank? and !application_credentials
|
34
37
|
logger.info("CapcOAuth: The access token for #{user_id_field} user ##{access_token.user_id} did not have an ID for type `#{user_id_field}`") unless logger.nil?
|
35
38
|
raise UnauthorizedError
|
36
39
|
end
|
@@ -43,6 +43,10 @@ module Capcoauth
|
|
43
43
|
@current_user
|
44
44
|
end
|
45
45
|
|
46
|
+
def capcoauth_token
|
47
|
+
@_capcoauth_token ||= OAuth::AccessToken.new(token_from_request)
|
48
|
+
end
|
49
|
+
|
46
50
|
protected
|
47
51
|
|
48
52
|
def handle_unauthorized
|
@@ -59,10 +63,6 @@ module Capcoauth
|
|
59
63
|
|
60
64
|
private
|
61
65
|
|
62
|
-
def capcoauth_token
|
63
|
-
@_capcoauth_token ||= OAuth::AccessToken.new(token_from_request)
|
64
|
-
end
|
65
|
-
|
66
66
|
def token_from_request
|
67
67
|
token_from_param || token_from_session || token_from_headers
|
68
68
|
end
|
data/lib/capcoauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capcoauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|