omniauth-boletosimples 0.0.9 → 0.1.0
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/.ruby-version +1 -1
- data/Gemfile +3 -1
- data/Gemfile.lock +29 -29
- data/Rakefile +3 -1
- data/lib/omniauth-boletosimples.rb +3 -1
- data/lib/omniauth/boletosimples.rb +3 -1
- data/lib/omniauth/boletosimples/version.rb +3 -1
- data/lib/omniauth/strategies/boletosimples.rb +22 -18
- data/omniauth-boletosimples.gemspec +6 -5
- data/spec/omniauth/strategies/boletosimples_spec.rb +7 -7
- data/spec/spec_helper.rb +4 -2
- data/spec/support/shared_examples.rb +8 -6
- metadata +7 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0060b4ecb03a3d5ca498fec9ed35b8cd5efd2a09176aad4f4edc4907dd0471e
|
|
4
|
+
data.tar.gz: 9f653f20372ee7e87bfffb0026c340d3a3e4f5cea7dd7389e16016a3d13fb0a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddb8e8d2309e00ca27ee4ae84c140a25dda8fdf7b654656e965a91600d808cf6be9eb8889618d1fdbe73fada3a45c96f8cd0c0fdaf71a02fff94b23365aff1cc
|
|
7
|
+
data.tar.gz: e529b3e2762e57790ef2b10f13baa481dc2cc071ed6a2ff2f9d028514ec355e5d521634d4780379d2074fe6e5b39931cca5bfe6dba4809da9ec3d139e773268e
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.6.3
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
omniauth-boletosimples (0.0
|
|
5
|
-
omniauth-oauth2 (~> 1.
|
|
4
|
+
omniauth-boletosimples (0.1.0)
|
|
5
|
+
omniauth-oauth2 (~> 1.6)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
diff-lcs (1.3)
|
|
11
|
-
faraday (0.
|
|
11
|
+
faraday (0.15.4)
|
|
12
12
|
multipart-post (>= 1.2, < 3)
|
|
13
|
-
hashie (3.
|
|
14
|
-
json (2.
|
|
15
|
-
jwt (
|
|
13
|
+
hashie (3.6.0)
|
|
14
|
+
json (2.2.0)
|
|
15
|
+
jwt (2.2.1)
|
|
16
16
|
multi_json (1.13.1)
|
|
17
17
|
multi_xml (0.6.0)
|
|
18
|
-
multipart-post (2.
|
|
19
|
-
oauth2 (1.4.
|
|
20
|
-
faraday (>= 0.8, < 0.
|
|
21
|
-
jwt (
|
|
18
|
+
multipart-post (2.1.1)
|
|
19
|
+
oauth2 (1.4.1)
|
|
20
|
+
faraday (>= 0.8, < 0.16.0)
|
|
21
|
+
jwt (>= 1.0, < 3.0)
|
|
22
22
|
multi_json (~> 1.3)
|
|
23
23
|
multi_xml (~> 0.5)
|
|
24
24
|
rack (>= 1.2, < 3)
|
|
25
|
-
omniauth (1.
|
|
26
|
-
hashie (>= 3.4.6, < 3.
|
|
25
|
+
omniauth (1.9.0)
|
|
26
|
+
hashie (>= 3.4.6, < 3.7.0)
|
|
27
27
|
rack (>= 1.6.2, < 3)
|
|
28
|
-
omniauth-oauth2 (1.
|
|
29
|
-
oauth2 (~> 1.
|
|
30
|
-
omniauth (~> 1.
|
|
31
|
-
rack (2.0.
|
|
32
|
-
rake (12.3.
|
|
33
|
-
rspec (3.
|
|
34
|
-
rspec-core (~> 3.
|
|
35
|
-
rspec-expectations (~> 3.
|
|
36
|
-
rspec-mocks (~> 3.
|
|
37
|
-
rspec-core (3.
|
|
38
|
-
rspec-support (~> 3.
|
|
39
|
-
rspec-expectations (3.
|
|
28
|
+
omniauth-oauth2 (1.6.0)
|
|
29
|
+
oauth2 (~> 1.1)
|
|
30
|
+
omniauth (~> 1.9)
|
|
31
|
+
rack (2.0.7)
|
|
32
|
+
rake (12.3.2)
|
|
33
|
+
rspec (3.8.0)
|
|
34
|
+
rspec-core (~> 3.8.0)
|
|
35
|
+
rspec-expectations (~> 3.8.0)
|
|
36
|
+
rspec-mocks (~> 3.8.0)
|
|
37
|
+
rspec-core (3.8.2)
|
|
38
|
+
rspec-support (~> 3.8.0)
|
|
39
|
+
rspec-expectations (3.8.4)
|
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
41
|
-
rspec-support (~> 3.
|
|
42
|
-
rspec-mocks (3.
|
|
41
|
+
rspec-support (~> 3.8.0)
|
|
42
|
+
rspec-mocks (3.8.1)
|
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
-
rspec-support (~> 3.
|
|
45
|
-
rspec-support (3.
|
|
44
|
+
rspec-support (~> 3.8.0)
|
|
45
|
+
rspec-support (3.8.2)
|
|
46
46
|
|
|
47
47
|
PLATFORMS
|
|
48
48
|
ruby
|
|
@@ -54,4 +54,4 @@ DEPENDENCIES
|
|
|
54
54
|
rspec
|
|
55
55
|
|
|
56
56
|
BUNDLED WITH
|
|
57
|
-
|
|
57
|
+
2.0.2
|
data/Rakefile
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'omniauth-oauth2'
|
|
2
4
|
|
|
3
5
|
module OmniAuth
|
|
4
6
|
module Strategies
|
|
5
7
|
class BoletoSimples < OmniAuth::Strategies::OAuth2
|
|
6
|
-
DEFAULT_SCOPE =
|
|
8
|
+
DEFAULT_SCOPE = 'profile'
|
|
7
9
|
ENVIRONMENTS = {
|
|
8
10
|
development: 'http://localhost:5000',
|
|
9
11
|
sandbox: 'https://sandbox.boletosimples.com.br',
|
|
10
12
|
production: 'https://boletosimples.com.br'
|
|
11
|
-
}
|
|
13
|
+
}.freeze
|
|
12
14
|
option :name, 'boletosimples'
|
|
13
|
-
option :client_options,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
option :client_options,
|
|
16
|
+
token_url: '/api/v1/oauth2/token',
|
|
17
|
+
setup: true
|
|
17
18
|
|
|
18
|
-
option :authorize_options, [
|
|
19
|
+
option :authorize_options, %i[scope response_type]
|
|
19
20
|
option :provider_ignores_state, true
|
|
20
21
|
option :environment, :production
|
|
21
22
|
|
|
@@ -33,7 +34,7 @@ module OmniAuth
|
|
|
33
34
|
cpf: raw_info['cpf'],
|
|
34
35
|
mother_name: raw_info['mother_name'],
|
|
35
36
|
father_name: raw_info['father_name'],
|
|
36
|
-
sex: raw_info['sex']
|
|
37
|
+
sex: raw_info['sex']
|
|
37
38
|
}
|
|
38
39
|
end
|
|
39
40
|
|
|
@@ -57,11 +58,13 @@ module OmniAuth
|
|
|
57
58
|
environment = options.environment || :production
|
|
58
59
|
options.client_options[:site] = ENVIRONMENTS[environment.to_sym]
|
|
59
60
|
options.client_options[:authorize_url] = "#{ENVIRONMENTS[environment.to_sym]}/api/v1/oauth2/authorize"
|
|
60
|
-
options.
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if options.user_agent
|
|
62
|
+
options.client_options[:connection_opts] = {
|
|
63
|
+
headers: {
|
|
64
|
+
'User-Agent' => options.user_agent
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
|
-
|
|
67
|
+
end
|
|
65
68
|
end
|
|
66
69
|
|
|
67
70
|
def raw_info
|
|
@@ -79,12 +82,13 @@ module OmniAuth
|
|
|
79
82
|
end
|
|
80
83
|
|
|
81
84
|
private
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
|
|
86
|
+
def load_identity
|
|
87
|
+
access_token.options[:mode] = :query
|
|
88
|
+
access_token.options[:param_name] = :access_token
|
|
89
|
+
access_token.options[:grant_type] = :authorization_code
|
|
90
|
+
access_token.get('/api/v1/userinfo').parsed
|
|
91
|
+
end
|
|
88
92
|
end
|
|
89
93
|
end
|
|
90
94
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
3
4
|
require 'omniauth/boletosimples/version'
|
|
4
5
|
|
|
5
6
|
Gem::Specification.new do |s|
|
|
@@ -16,8 +17,8 @@ Gem::Specification.new do |s|
|
|
|
16
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
17
18
|
s.require_paths = ['lib']
|
|
18
19
|
|
|
19
|
-
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.
|
|
20
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
|
|
20
21
|
|
|
21
|
-
s.add_development_dependency 'rspec'
|
|
22
22
|
s.add_development_dependency 'rake'
|
|
23
|
-
|
|
23
|
+
s.add_development_dependency 'rspec'
|
|
24
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper'
|
|
2
4
|
require 'omniauth-boletosimples'
|
|
3
5
|
|
|
@@ -15,7 +17,7 @@ describe OmniAuth::Strategies::BoletoSimples do
|
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
it 'has correct BoletoSimples sandbox site' do
|
|
18
|
-
@options = { :
|
|
20
|
+
@options = { environment: :sandbox }
|
|
19
21
|
subject.setup_phase
|
|
20
22
|
expect(subject.client.site).to eq('https://sandbox.boletosimples.com.br')
|
|
21
23
|
end
|
|
@@ -26,7 +28,7 @@ describe OmniAuth::Strategies::BoletoSimples do
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
it 'has correct sandbox authorize url' do
|
|
29
|
-
@options = { :
|
|
31
|
+
@options = { environment: :sandbox }
|
|
30
32
|
subject.setup_phase
|
|
31
33
|
expect(subject.client.options[:authorize_url]).to eq('https://sandbox.boletosimples.com.br/api/v1/oauth2/authorize')
|
|
32
34
|
end
|
|
@@ -36,17 +38,15 @@ describe OmniAuth::Strategies::BoletoSimples do
|
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
it 'has correct connection_opts' do
|
|
39
|
-
@options = { :
|
|
41
|
+
@options = { user_agent: 'email@example.com' }
|
|
40
42
|
subject.setup_phase
|
|
41
|
-
expect(subject.client.options[:connection_opts]).to eq(
|
|
43
|
+
expect(subject.client.options[:connection_opts]).to eq(headers: { "User-Agent": 'email@example.com' })
|
|
42
44
|
end
|
|
43
|
-
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
describe '#callback_path' do
|
|
47
|
-
it
|
|
48
|
+
it 'has the correct callback path' do
|
|
48
49
|
expect(subject.callback_path).to eq('/auth/boletosimples/callback')
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
|
-
|
|
52
52
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'bundler/setup'
|
|
2
4
|
require 'rspec'
|
|
3
5
|
require 'omniauth'
|
|
4
|
-
Dir[File.expand_path('
|
|
6
|
+
Dir[File.expand_path('support/**/*', __dir__)].each { |f| require f }
|
|
5
7
|
|
|
6
|
-
RSpec.configure do |
|
|
8
|
+
RSpec.configure do |_config|
|
|
7
9
|
OmniAuth.config.test_mode = true
|
|
8
10
|
end
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
|
2
4
|
shared_examples 'an oauth2 strategy' do
|
|
3
5
|
describe '#client' do
|
|
4
6
|
it 'should be initialized with symbolized client_options' do
|
|
5
|
-
@options = { :
|
|
7
|
+
@options = { client_options: { 'authorize_url' => 'https://example.com' } }
|
|
6
8
|
expect(subject.client.options[:authorize_url]).to eq('https://example.com')
|
|
7
9
|
end
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
describe '#authorize_params' do
|
|
11
13
|
it 'should include any authorize params passed in the :authorize_params option' do
|
|
12
|
-
@options = { :
|
|
14
|
+
@options = { authorize_params: { foo: 'bar', baz: 'zip' } }
|
|
13
15
|
expect(subject.authorize_params['foo']).to eq('bar')
|
|
14
16
|
expect(subject.authorize_params['baz']).to eq('zip')
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
it 'should include top-level options that are marked as :authorize_options' do
|
|
18
|
-
@options = { :
|
|
20
|
+
@options = { authorize_options: %i[scope foo], scope: 'bar', foo: 'baz' }
|
|
19
21
|
expect(subject.authorize_params['scope']).to eq('bar')
|
|
20
22
|
expect(subject.authorize_params['foo']).to eq('baz')
|
|
21
23
|
end
|
|
@@ -23,15 +25,15 @@ shared_examples 'an oauth2 strategy' do
|
|
|
23
25
|
|
|
24
26
|
describe '#token_params' do
|
|
25
27
|
it 'should include any token params passed in the :token_params option' do
|
|
26
|
-
@options = { :
|
|
28
|
+
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
|
27
29
|
expect(subject.token_params['foo']).to eq('bar')
|
|
28
30
|
expect(subject.token_params['baz']).to eq('zip')
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
it 'should include top-level options that are marked as :token_options' do
|
|
32
|
-
@options = { :
|
|
34
|
+
@options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
|
|
33
35
|
expect(subject.token_params['scope']).to eq('bar')
|
|
34
36
|
expect(subject.token_params['foo']).to eq('baz')
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
|
-
end
|
|
39
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-boletosimples
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rafael Lima
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: omniauth-oauth2
|
|
@@ -17,16 +17,16 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 1.
|
|
20
|
+
version: '1.6'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: 1.
|
|
27
|
+
version: '1.6'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
29
|
+
name: rake
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
32
|
- - ">="
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
|
-
name:
|
|
43
|
+
name: rspec
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
46
|
- - ">="
|
|
@@ -98,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
|
|
102
|
-
rubygems_version: 2.7.3
|
|
101
|
+
rubygems_version: 3.0.3
|
|
103
102
|
signing_key:
|
|
104
103
|
specification_version: 4
|
|
105
104
|
summary: BoletoSimples strategy for OmniAuth
|