omniauth-varejonline 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth-varejonline/version.rb +1 -1
- data/lib/omniauth/strategies/varejonline.rb +7 -47
- 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: f8cbcf7b2c4bc3dcc51bd3d01d9eea3bbef73d9d
|
4
|
+
data.tar.gz: dc9381c86f2594deed7b176145cb09030855172a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b1c96ea71371be9825ff5cb85a3bb0506d4dea647109948139d3a0611a732208f99f0825f9033f76d9cdefc4c210d23549b86e00c538295ccefc237d4ff97dc
|
7
|
+
data.tar.gz: 4ee0ae4d282248ddcf2efb43aea404641be0eb5138d9a85c49e76b4cbc5e019a9f3ff64bd94af975df6cfddc4552ae1c51655e98fa9abacf52d65e74e396701d
|
@@ -8,21 +8,19 @@ module OmniAuth
|
|
8
8
|
DEFAULT_SCOPE = "all"
|
9
9
|
|
10
10
|
option :name, 'varejonline'
|
11
|
-
option :authorize_options, [:
|
12
|
-
option :provider_ignores_state,
|
11
|
+
option :authorize_options, [:client_id, :redirect_uri, :client_secret]
|
12
|
+
option :provider_ignores_state, true
|
13
13
|
|
14
14
|
option :client_options, {
|
15
|
-
:site => 'https://
|
15
|
+
:site => 'https://erp.varejonline.com.br',
|
16
16
|
:authorize_url => '/apps/oauth/authorization?response_type=code',
|
17
17
|
:token_url => '/apps/oauth/token'
|
18
18
|
}
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
def request_phase
|
25
|
-
redirect client.auth_code.authorize_url({:redirect_uri => options.redirect_uri }.merge(options.authorize_params)).gsub("client_id", "app_id")
|
20
|
+
def build_access_token
|
21
|
+
verifier = request.params["code"]
|
22
|
+
|
23
|
+
client.auth_code.get_token(verifier, {:redirect_uri => callback_url.gsub(/\?(.*)/, "")}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
|
26
24
|
end
|
27
25
|
|
28
26
|
info do
|
@@ -47,42 +45,4 @@ module OmniAuth
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
50
|
-
end
|
51
|
-
|
52
|
-
module OAuth2
|
53
|
-
class Client
|
54
|
-
def get_token(params, access_token_opts={})
|
55
|
-
opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
|
56
|
-
|
57
|
-
if options[:token_method] == :post
|
58
|
-
headers = params.delete(:headers)
|
59
|
-
|
60
|
-
if params[:formato] == :json
|
61
|
-
params[:redirect_uri] = params[:redirect_uri].gsub(/\?(.*)/, "")
|
62
|
-
|
63
|
-
opts[:body] = params.to_json
|
64
|
-
opts[:headers] = {'Content-Type' => 'application/json'}
|
65
|
-
else
|
66
|
-
opts[:body] = params
|
67
|
-
opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
|
68
|
-
end
|
69
|
-
|
70
|
-
opts[:headers].merge!(headers) if headers
|
71
|
-
else
|
72
|
-
opts[:params] = params
|
73
|
-
end
|
74
|
-
|
75
|
-
response = request(options[:token_method], token_url, opts)
|
76
|
-
raise Error.new(response) if options[:raise_errors] && !(response.parsed.is_a?(Hash) && response.parsed['access_token'])
|
77
|
-
AccessToken.from_hash(self, response.parsed.merge(access_token_opts))
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
module Strategy
|
82
|
-
class Base
|
83
|
-
def client_params
|
84
|
-
{'app_id' => @client.id, 'app_secret' => @client.secret, 'client_id' => @client.id, 'client_secret' => @client.secret}
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-varejonline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Paulo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
12
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|