omniauth-scalus-oauth2 1.0.1 → 1.0.2
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/README.md +1 -1
- data/lib/omniauth/scalus/version.rb +1 -1
- data/lib/omniauth/strategies/scalus.rb +2 -2
- data/omniauth-scalus-oauth2.gemspec +2 -0
- data/spec/omniauth/strategies/scalus_spec.rb +2 -2
- data/test/integration_test.rb +9 -8
- 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: f286c70cbe5b4e90b35970f4b247b86762936e29
|
4
|
+
data.tar.gz: 3305c25d847d8bd0004830cc1e5609c53efbdd77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc08cebe25975bafefb7ddcd2b4d01d96ccfac2be70c931e0bc8503b5810492461ad9843191ea9c3816af55e7c5ce7491b3a7714e7b35854511f7c110675321
|
7
|
+
data.tar.gz: 366d227b168699c9d6ddc81cc15ba3baaabece1fad495b052567241ad9e4fb611bb6b767528d63187a37e07eab36a6dd9b923aae3cbf9f8d11cf7f78b3dd23d9
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ Here's an example *Authentication Hash* available in `request.env['omniauth.auth
|
|
45
45
|
```ruby
|
46
46
|
{
|
47
47
|
:provider => 'scalus',
|
48
|
-
:uid => '
|
48
|
+
:uid => 'example_slug.scalus.com', # example\_slug is the organization's subdomain
|
49
49
|
:credentials => {
|
50
50
|
:token => 'afasd923kjh0934kf', # OAuth 2.0 access_token, which you store and use to authenticate API requests
|
51
51
|
}
|
@@ -10,8 +10,8 @@ module OmniAuth
|
|
10
10
|
CODE_EXPIRES_AFTER = 10 * MINUTE
|
11
11
|
|
12
12
|
option :client_options, {
|
13
|
-
:authorize_url => '/
|
14
|
-
:token_url => '/
|
13
|
+
:authorize_url => '/oauth2/authorize',
|
14
|
+
:token_url => '/oauth2/access_token'
|
15
15
|
}
|
16
16
|
|
17
17
|
option :callback_url
|
@@ -42,11 +42,11 @@ describe OmniAuth::Strategies::Scalus do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'has correct authorize url' do
|
45
|
-
subject.client.options[:authorize_url].should eq('/
|
45
|
+
subject.client.options[:authorize_url].should eq('/oauth2/authorize')
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'has correct token url' do
|
49
|
-
subject.client.options[:token_url].should eq('/
|
49
|
+
subject.client.options[:token_url].should eq('/oauth2/access_token')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
data/test/integration_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
|
+
# require 'byebug'
|
2
3
|
|
3
4
|
class IntegrationTest < Minitest::Test
|
4
5
|
def setup
|
@@ -13,7 +14,7 @@ class IntegrationTest < Minitest::Test
|
|
13
14
|
def test_authorize
|
14
15
|
response = authorize('snowdevil.scalus.com')
|
15
16
|
assert_equal 302, response.status
|
16
|
-
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.com/
|
17
|
+
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.com/oauth2/authorize?")}/, response.location
|
17
18
|
redirect_params = Rack::Utils.parse_query(URI(response.location).query)
|
18
19
|
assert_equal "123", redirect_params['client_id']
|
19
20
|
assert_equal "https://app.example.com/auth/scalus/callback", redirect_params['redirect_uri']
|
@@ -27,7 +28,7 @@ class IntegrationTest < Minitest::Test
|
|
27
28
|
}
|
28
29
|
|
29
30
|
response = authorize('snowdevil.scalus.com')
|
30
|
-
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.com/
|
31
|
+
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.com/oauth2/authorize?")}/, response.location
|
31
32
|
end
|
32
33
|
|
33
34
|
def test_site_validation
|
@@ -71,7 +72,7 @@ class IntegrationTest < Minitest::Test
|
|
71
72
|
def test_callback_custom_params
|
72
73
|
access_token = SecureRandom.hex(16)
|
73
74
|
code = SecureRandom.hex(16)
|
74
|
-
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/
|
75
|
+
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/oauth2/access_token",
|
75
76
|
body: JSON.dump(access_token: access_token),
|
76
77
|
content_type: 'application/json')
|
77
78
|
|
@@ -121,7 +122,7 @@ class IntegrationTest < Minitest::Test
|
|
121
122
|
|
122
123
|
def test_provider_options
|
123
124
|
build_app scope: 'read_products,read_orders,write_content',
|
124
|
-
callback_path: '/
|
125
|
+
callback_path: '/auth/legacy/callback',
|
125
126
|
scalus_domain: 'scalus.dev:3000',
|
126
127
|
setup: lambda { |env|
|
127
128
|
organization = Rack::Request.new(env).GET['organization']
|
@@ -131,15 +132,15 @@ class IntegrationTest < Minitest::Test
|
|
131
132
|
|
132
133
|
response = authorize('snowdevil')
|
133
134
|
assert_equal 302, response.status
|
134
|
-
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.dev:3000/
|
135
|
+
assert_match /\A#{Regexp.quote("https://snowdevil.scalus.dev:3000/oauth2/authorize?")}/, response.location
|
135
136
|
redirect_params = Rack::Utils.parse_query(URI(response.location).query)
|
136
137
|
assert_equal 'read_products,read_orders,write_content', redirect_params['scope']
|
137
|
-
assert_equal 'https://app.example.com/
|
138
|
+
assert_equal 'https://app.example.com/auth/legacy/callback', redirect_params['redirect_uri']
|
138
139
|
end
|
139
140
|
def test_callback_with_invalid_state_fails
|
140
141
|
access_token = SecureRandom.hex(16)
|
141
142
|
code = SecureRandom.hex(16)
|
142
|
-
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/
|
143
|
+
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/oauth2/access_token",
|
143
144
|
body: JSON.dump(access_token: access_token),
|
144
145
|
content_type: 'application/json')
|
145
146
|
|
@@ -161,7 +162,7 @@ class IntegrationTest < Minitest::Test
|
|
161
162
|
end
|
162
163
|
|
163
164
|
def expect_access_token_request(access_token)
|
164
|
-
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/
|
165
|
+
FakeWeb.register_uri(:post, "https://snowdevil.scalus.com/oauth2/access_token",
|
165
166
|
body: JSON.dump(access_token: access_token),
|
166
167
|
content_type: 'application/json')
|
167
168
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-scalus-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Henner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|