zaikio-oauth_client 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zaikio/oauth_client/version.rb +1 -1
- data/lib/zaikio/oauth_client.rb +9 -0
- 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: 18ff86a2a9302a3e1b9b1d26713b63c95d0c88835760d0fd10be57167154d5ec
|
4
|
+
data.tar.gz: 1cefd5a0abb861d6a9d2dbdb45c80d9f6ba592b250be72527be9bbaacc924a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d4623a440c5ecb8d989df4757f77fd890d15272d2a8e1af077ec0da77292f488c24f239926072c517803cba22ef750a8f14c66f9f5e765e076136081813f8d6
|
7
|
+
data.tar.gz: 1e77a452cc6fa4a2b40be38ede7c5115d36e0e113a682e165c7c7a0ca57c758077644a50d9bbd034275d0ba002344ebd1b5e9b9702f2618712b4801a00498900
|
data/lib/zaikio/oauth_client.rb
CHANGED
@@ -8,6 +8,7 @@ module Zaikio
|
|
8
8
|
module OAuthClient
|
9
9
|
class << self
|
10
10
|
attr_accessor :configuration
|
11
|
+
attr_reader :client_name
|
11
12
|
|
12
13
|
def configure
|
13
14
|
self.configuration ||= Configuration.new
|
@@ -29,6 +30,13 @@ module Zaikio
|
|
29
30
|
@oauth_scheme = :request_body
|
30
31
|
end
|
31
32
|
|
33
|
+
def with_client(client_name)
|
34
|
+
@client_name = client_name
|
35
|
+
yield
|
36
|
+
ensure
|
37
|
+
@client_name = nil
|
38
|
+
end
|
39
|
+
|
32
40
|
def with_auth(options_or_access_token, &block)
|
33
41
|
access_token = if options_or_access_token.is_a?(Zaikio::AccessToken)
|
34
42
|
options_or_access_token
|
@@ -46,6 +54,7 @@ module Zaikio
|
|
46
54
|
end
|
47
55
|
|
48
56
|
def get_access_token(client_name: nil, bearer_type: "Person", bearer_id: nil, scopes: nil) # rubocop:disable Metrics/MethodLength
|
57
|
+
client_name ||= self.client_name
|
49
58
|
client_config = client_config_for(client_name)
|
50
59
|
scopes ||= client_config.default_scopes_for(bearer_type)
|
51
60
|
|