authkeeper 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/lib/authkeeper/google_auth_api/requests/fetch_access_token.rb +1 -1
- data/app/lib/authkeeper/http_service/client.rb +18 -2
- data/app/lib/authkeeper/vk_auth_api/requests/access_token.rb +6 -6
- data/app/lib/authkeeper/yandex_auth_api/requests/access_token.rb +6 -6
- data/lib/authkeeper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c436194b9b10209087de9a23e793a03cb9dc222748fe9b2d040d17e84b1f0b3b
|
|
4
|
+
data.tar.gz: 73af525eb9235b3d3e0cc8c31159d5665c42a829b3548ba0ce2e9dfd676791bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ad5ea1075dfac7c1b18f12b00eb4ce3a3ff17c8aace3a603dd6660fc0210630d672d4496ede00305f8b84b115833c97bb001dd6d5c187ee88367b877053ee7b
|
|
7
|
+
data.tar.gz: c98938d5da6d1fb5f5c333143384806fcfd0bffed5a2c45fdef6cbdd0e1b338fe20bc1bd285952bee8aec112d72e4bab3b8b7a7add03acc6951ef1c2dd2e0596
|
|
@@ -22,8 +22,7 @@ module Authkeeper
|
|
|
22
22
|
}
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
def post(path:, body: nil, headers: nil)
|
|
25
|
+
def no_params_post(path:, body: nil, headers: nil)
|
|
27
26
|
if Rails.env.test? && connection.adapter != 'Faraday::Adapter::Test'
|
|
28
27
|
raise StandardError, 'please stub request in test env'
|
|
29
28
|
end
|
|
@@ -32,6 +31,23 @@ module Authkeeper
|
|
|
32
31
|
response.body if response.success?
|
|
33
32
|
end
|
|
34
33
|
|
|
34
|
+
def post(path:, body: {}, params: {}, headers: {}) # rubocop: disable Metrics/AbcSize
|
|
35
|
+
if Rails.env.test? && connection.adapter != 'Faraday::Adapter::Test'
|
|
36
|
+
raise StandardError, 'please stub request in test env'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
response = connection.post(path) do |request|
|
|
40
|
+
params.each do |param, value|
|
|
41
|
+
request.params[param] = value
|
|
42
|
+
end
|
|
43
|
+
headers.each do |header, value|
|
|
44
|
+
request.headers[header] = value
|
|
45
|
+
end
|
|
46
|
+
request.body = body.to_json
|
|
47
|
+
end
|
|
48
|
+
response.body if response.success?
|
|
49
|
+
end
|
|
50
|
+
|
|
35
51
|
def form_post(path:, body: {}, params: {}, headers: {})
|
|
36
52
|
if Rails.env.test? && connection.adapter != 'Faraday::Adapter::Test'
|
|
37
53
|
raise StandardError, 'please stub request in test env'
|
|
@@ -7,9 +7,9 @@ module Authkeeper
|
|
|
7
7
|
module Requests
|
|
8
8
|
module AccessToken
|
|
9
9
|
def fetch_access_token(client_id:, redirect_url:, device_id:, code:, state:, code_verifier:)
|
|
10
|
-
|
|
10
|
+
form_post(
|
|
11
11
|
path: 'oauth2/auth',
|
|
12
|
-
body:
|
|
12
|
+
body: {
|
|
13
13
|
grant_type: 'authorization_code',
|
|
14
14
|
client_id: client_id,
|
|
15
15
|
device_id: device_id,
|
|
@@ -17,7 +17,7 @@ module Authkeeper
|
|
|
17
17
|
state: state,
|
|
18
18
|
redirect_uri: redirect_url,
|
|
19
19
|
code_verifier: code_verifier
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
21
|
headers: {
|
|
22
22
|
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
23
23
|
}
|
|
@@ -25,15 +25,15 @@ module Authkeeper
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def refresh_access_token(client_id:, refresh_token:, device_id:, state:)
|
|
28
|
-
|
|
28
|
+
form_post(
|
|
29
29
|
path: 'oauth2/auth',
|
|
30
|
-
body:
|
|
30
|
+
body: {
|
|
31
31
|
grant_type: 'refresh_token',
|
|
32
32
|
client_id: client_id,
|
|
33
33
|
device_id: device_id,
|
|
34
34
|
refresh_token: refresh_token,
|
|
35
35
|
state: state
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
headers: {
|
|
38
38
|
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
39
39
|
}
|
|
@@ -8,14 +8,14 @@ module Authkeeper
|
|
|
8
8
|
module Requests
|
|
9
9
|
module AccessToken
|
|
10
10
|
def fetch_access_token(client_id:, client_secret:, code:)
|
|
11
|
-
|
|
11
|
+
form_post(
|
|
12
12
|
path: 'token',
|
|
13
|
-
body:
|
|
13
|
+
body: {
|
|
14
14
|
grant_type: 'authorization_code',
|
|
15
15
|
client_id: client_id,
|
|
16
16
|
client_secret: client_secret,
|
|
17
17
|
code: code
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
headers: {
|
|
20
20
|
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
21
21
|
}
|
|
@@ -23,12 +23,12 @@ module Authkeeper
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def refresh_access_token(client_id:, client_secret:, refresh_token:)
|
|
26
|
-
|
|
26
|
+
form_post(
|
|
27
27
|
path: 'token',
|
|
28
|
-
body:
|
|
28
|
+
body: {
|
|
29
29
|
grant_type: 'refresh_token',
|
|
30
30
|
refresh_token: refresh_token
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
headers: {
|
|
33
33
|
'Content-Type' => 'application/x-www-form-urlencoded',
|
|
34
34
|
'Authorization' => "Basic #{authorization(client_id, client_secret)}"
|
data/lib/authkeeper/version.rb
CHANGED