omniauth-bigcommerce 0.3.0 → 0.3.1
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/Gemfile +15 -0
- data/lib/omniauth-bigcommerce.rb +15 -0
- data/lib/omniauth/bigcommerce/version.rb +16 -1
- data/lib/omniauth/strategies/bigcommerce.rb +24 -6
- data/omniauth-bigcommerce.gemspec +26 -12
- metadata +35 -28
- data/.gitignore +0 -6
- data/.travis.yml +0 -9
- data/Guardfile +0 -10
- data/Rakefile +0 -8
- data/spec/omniauth/strategies/bigcommerce_spec.rb +0 -76
- data/spec/spec_helper.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8618436093af6d83d82236494985dfe110886799
|
|
4
|
+
data.tar.gz: 210c88c36c40ff4caf1cbb53deefc5d32858a5bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee45fa6f7e285b296f4b7b9408f3842142c4d98df6a5c92ceba55700c0f7f7bdfd1c6a710f3d86052b1b800358c7c6cb3af7816544f5c01ec2f9a1d55443939f
|
|
7
|
+
data.tar.gz: ff219bad1d042f964c95dd43d4c7dc105660461b6cddd3da3e4419a3acd28eaa9570c2da93dff2d0301d61a23676bdf909c3e9f399252b7387c855fe832acb67
|
data/Gemfile
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
# Software.
|
|
10
|
+
#
|
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
#
|
|
1
16
|
source 'https://rubygems.org'
|
|
2
17
|
|
|
3
18
|
gemspec
|
data/lib/omniauth-bigcommerce.rb
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
# Software.
|
|
10
|
+
#
|
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
#
|
|
1
16
|
require 'omniauth/bigcommerce/version'
|
|
2
17
|
require 'omniauth/strategies/bigcommerce'
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
# Software.
|
|
10
|
+
#
|
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
#
|
|
1
16
|
module OmniAuth
|
|
2
17
|
module BigCommerce
|
|
3
|
-
VERSION = '0.3.
|
|
18
|
+
VERSION = '0.3.1'.freeze
|
|
4
19
|
end
|
|
5
20
|
end
|
|
@@ -1,25 +1,43 @@
|
|
|
1
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
# Software.
|
|
10
|
+
#
|
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
#
|
|
1
16
|
require 'omniauth-oauth2'
|
|
2
17
|
|
|
3
18
|
module OmniAuth
|
|
4
19
|
module Strategies
|
|
20
|
+
##
|
|
21
|
+
# BigCommerce OAuth strategy for OmniAuth
|
|
22
|
+
#
|
|
5
23
|
class BigCommerce < OmniAuth::Strategies::OAuth2
|
|
6
24
|
option :name, 'bigcommerce'
|
|
7
25
|
option :provider_ignores_state, true
|
|
8
26
|
option :scope, 'users_basic_information'
|
|
9
27
|
option :authorize_options, [:scope, :context]
|
|
10
28
|
option :token_options, [:scope, :context]
|
|
11
|
-
option :client_options,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
option :client_options,
|
|
30
|
+
site: ENV.fetch('BC_AUTH_SERVICE', 'https://login.bigcommerce.com'),
|
|
31
|
+
authorize_url: '/oauth2/authorize',
|
|
32
|
+
token_url: '/oauth2/token'
|
|
33
|
+
|
|
16
34
|
|
|
17
35
|
uid { access_token.params['user']['id'] }
|
|
18
36
|
|
|
19
37
|
info do
|
|
20
38
|
{
|
|
21
39
|
name: access_token.params['user']['username'],
|
|
22
|
-
email: access_token.params['user']['email']
|
|
40
|
+
email: access_token.params['user']['email']
|
|
23
41
|
}
|
|
24
42
|
end
|
|
25
43
|
|
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
# persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
# Software.
|
|
10
|
+
#
|
|
11
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
#
|
|
2
16
|
require File.expand_path('../lib/omniauth/bigcommerce/version', __FILE__)
|
|
3
17
|
|
|
4
18
|
Gem::Specification.new do |gem|
|
|
5
|
-
gem.authors = [
|
|
6
|
-
gem.email = [
|
|
7
|
-
gem.description =
|
|
8
|
-
gem.summary =
|
|
9
|
-
gem.homepage =
|
|
19
|
+
gem.authors = ['BigCommerce Engineering']
|
|
20
|
+
gem.email = ['developer@bigcommerce.com']
|
|
21
|
+
gem.description = 'Official OmniAuth strategy for BigCommerce.'
|
|
22
|
+
gem.summary = gem.description
|
|
23
|
+
gem.homepage = 'https://github.com/bigcommerce/omniauth-bigcommerce'
|
|
10
24
|
|
|
11
|
-
gem.
|
|
12
|
-
gem.
|
|
13
|
-
gem.
|
|
14
|
-
gem.name = "omniauth-bigcommerce"
|
|
15
|
-
gem.require_paths = ["lib"]
|
|
25
|
+
gem.files = Dir['README.md', 'lib/**/*', 'omniauth-bigcommerce.gemspec', 'Gemfile']
|
|
26
|
+
gem.name = 'omniauth-bigcommerce'
|
|
27
|
+
gem.require_paths = ['lib']
|
|
16
28
|
gem.required_ruby_version = '>= 2.1'
|
|
17
29
|
gem.version = OmniAuth::BigCommerce::VERSION
|
|
30
|
+
gem.license = 'MIT'
|
|
18
31
|
|
|
32
|
+
gem.add_dependency 'oauth2', '~> 1.3.1'
|
|
19
33
|
gem.add_dependency 'omniauth'
|
|
20
|
-
gem.add_dependency 'omniauth-oauth2', '>= 1.
|
|
34
|
+
gem.add_dependency 'omniauth-oauth2', '>= 1.5'
|
|
21
35
|
gem.add_development_dependency 'rake'
|
|
22
36
|
gem.add_development_dependency 'rspec'
|
|
23
37
|
gem.add_development_dependency 'simplecov'
|
metadata
CHANGED
|
@@ -1,83 +1,97 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-bigcommerce
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- BigCommerce Engineering
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: oauth2
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 1.3.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 1.3.1
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: omniauth
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
16
30
|
requirements:
|
|
17
|
-
- -
|
|
31
|
+
- - ">="
|
|
18
32
|
- !ruby/object:Gem::Version
|
|
19
33
|
version: '0'
|
|
20
34
|
type: :runtime
|
|
21
35
|
prerelease: false
|
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
37
|
requirements:
|
|
24
|
-
- -
|
|
38
|
+
- - ">="
|
|
25
39
|
- !ruby/object:Gem::Version
|
|
26
40
|
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: omniauth-oauth2
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
30
44
|
requirements:
|
|
31
|
-
- -
|
|
45
|
+
- - ">="
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 1.
|
|
47
|
+
version: '1.5'
|
|
34
48
|
type: :runtime
|
|
35
49
|
prerelease: false
|
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
51
|
requirements:
|
|
38
|
-
- -
|
|
52
|
+
- - ">="
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 1.
|
|
54
|
+
version: '1.5'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: rake
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
44
58
|
requirements:
|
|
45
|
-
- -
|
|
59
|
+
- - ">="
|
|
46
60
|
- !ruby/object:Gem::Version
|
|
47
61
|
version: '0'
|
|
48
62
|
type: :development
|
|
49
63
|
prerelease: false
|
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
65
|
requirements:
|
|
52
|
-
- -
|
|
66
|
+
- - ">="
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: rspec
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
|
-
- -
|
|
73
|
+
- - ">="
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
75
|
version: '0'
|
|
62
76
|
type: :development
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
|
-
- -
|
|
80
|
+
- - ">="
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
82
|
version: '0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: simplecov
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
72
86
|
requirements:
|
|
73
|
-
- -
|
|
87
|
+
- - ">="
|
|
74
88
|
- !ruby/object:Gem::Version
|
|
75
89
|
version: '0'
|
|
76
90
|
type: :development
|
|
77
91
|
prerelease: false
|
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
93
|
requirements:
|
|
80
|
-
- -
|
|
94
|
+
- - ">="
|
|
81
95
|
- !ruby/object:Gem::Version
|
|
82
96
|
version: '0'
|
|
83
97
|
description: Official OmniAuth strategy for BigCommerce.
|
|
@@ -87,20 +101,15 @@ executables: []
|
|
|
87
101
|
extensions: []
|
|
88
102
|
extra_rdoc_files: []
|
|
89
103
|
files:
|
|
90
|
-
- .gitignore
|
|
91
|
-
- .travis.yml
|
|
92
104
|
- Gemfile
|
|
93
|
-
- Guardfile
|
|
94
105
|
- README.md
|
|
95
|
-
- Rakefile
|
|
96
106
|
- lib/omniauth-bigcommerce.rb
|
|
97
107
|
- lib/omniauth/bigcommerce/version.rb
|
|
98
108
|
- lib/omniauth/strategies/bigcommerce.rb
|
|
99
109
|
- omniauth-bigcommerce.gemspec
|
|
100
|
-
- spec/omniauth/strategies/bigcommerce_spec.rb
|
|
101
|
-
- spec/spec_helper.rb
|
|
102
110
|
homepage: https://github.com/bigcommerce/omniauth-bigcommerce
|
|
103
|
-
licenses:
|
|
111
|
+
licenses:
|
|
112
|
+
- MIT
|
|
104
113
|
metadata: {}
|
|
105
114
|
post_install_message:
|
|
106
115
|
rdoc_options: []
|
|
@@ -108,20 +117,18 @@ require_paths:
|
|
|
108
117
|
- lib
|
|
109
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
119
|
requirements:
|
|
111
|
-
- -
|
|
120
|
+
- - ">="
|
|
112
121
|
- !ruby/object:Gem::Version
|
|
113
122
|
version: '2.1'
|
|
114
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
124
|
requirements:
|
|
116
|
-
- -
|
|
125
|
+
- - ">="
|
|
117
126
|
- !ruby/object:Gem::Version
|
|
118
127
|
version: '0'
|
|
119
128
|
requirements: []
|
|
120
129
|
rubyforge_project:
|
|
121
|
-
rubygems_version: 2.
|
|
130
|
+
rubygems_version: 2.6.14
|
|
122
131
|
signing_key:
|
|
123
132
|
specification_version: 4
|
|
124
133
|
summary: Official OmniAuth strategy for BigCommerce.
|
|
125
|
-
test_files:
|
|
126
|
-
- spec/omniauth/strategies/bigcommerce_spec.rb
|
|
127
|
-
- spec/spec_helper.rb
|
|
134
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Guardfile
DELETED
data/Rakefile
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe OmniAuth::Strategies::BigCommerce do
|
|
4
|
-
let(:store_hash) { 'abcdefg' }
|
|
5
|
-
let(:context) { "stores/#{store_hash}" }
|
|
6
|
-
let(:scope) { 'store_v2_products' }
|
|
7
|
-
let(:request) { double('Request', :params => { 'context' => context, 'scope' => scope }, :cookies => {}, :env => {}) }
|
|
8
|
-
|
|
9
|
-
before do
|
|
10
|
-
OmniAuth.config.test_mode = true
|
|
11
|
-
allow(subject).to receive(:request).and_return(request)
|
|
12
|
-
end
|
|
13
|
-
after { OmniAuth.config.test_mode = false }
|
|
14
|
-
subject { OmniAuth::Strategies::BigCommerce.new({}) }
|
|
15
|
-
|
|
16
|
-
describe 'options' do
|
|
17
|
-
it 'should have correct name' do
|
|
18
|
-
expect(subject.options.name).to eq('bigcommerce')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'client options' do
|
|
22
|
-
it 'should have correct site' do
|
|
23
|
-
# env variable set in spec_helper.rb
|
|
24
|
-
# TODO: change this once we have bigcommerceapp.com url
|
|
25
|
-
expect(subject.options.client_options.site).to eq('https://example.com')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'should have correct authorize url' do
|
|
29
|
-
expect(subject.options.client_options.authorize_url).to eq('/oauth2/authorize')
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'should have correct token url' do
|
|
33
|
-
expect(subject.options.client_options.token_url).to eq('/oauth2/token')
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe 'OAuth2 settings' do
|
|
38
|
-
it 'should ignore state' do
|
|
39
|
-
expect(subject.options.provider_ignores_state).to eq true
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe 'callback url' do
|
|
45
|
-
it 'should have the correct path' do
|
|
46
|
-
expect(subject.callback_path).to eq('/auth/bigcommerce/callback')
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
context 'when callback url has a query string' do
|
|
50
|
-
let(:host) { 'https://example.com' }
|
|
51
|
-
let(:query_string) { 'foo=bar' }
|
|
52
|
-
before do
|
|
53
|
-
allow(subject).to receive(:full_host).and_return(host)
|
|
54
|
-
allow(subject).to receive(:script_name).and_return('')
|
|
55
|
-
allow(subject).to receive(:query_string).and_return(query_string)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it 'query string should not be included in the callback url' do
|
|
59
|
-
expect(subject.callback_url).to eq("#{host}#{subject.callback_path}")
|
|
60
|
-
expect(subject.callback_url).to_not include(query_string)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
describe 'extra params for authorize and token exchange' do
|
|
66
|
-
it 'should set the context and scope parameters in the authorize request' do
|
|
67
|
-
expect(subject.authorize_params['context']).to eq(context)
|
|
68
|
-
expect(subject.authorize_params['scope']).to eq(scope)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'should set the context and scope parameters in the token request' do
|
|
72
|
-
expect(subject.token_params['context']).to eq(context)
|
|
73
|
-
expect(subject.token_params['scope']).to eq(scope)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
data/spec/spec_helper.rb
DELETED