omniauth-auth0 2.1.0 → 2.4.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/.circleci/config.yml +22 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- data/.github/stale.yml +20 -0
- data/.gitignore +1 -2
- data/.snyk +9 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +167 -0
- data/README.md +34 -17
- data/codecov.yml +22 -0
- data/lib/omniauth-auth0.rb +1 -1
- data/lib/omniauth-auth0/version.rb +1 -1
- data/lib/omniauth/auth0/errors.rb +11 -0
- data/lib/omniauth/auth0/jwt_validator.rb +158 -29
- data/lib/omniauth/auth0/telemetry.rb +36 -0
- data/lib/omniauth/strategies/auth0.rb +41 -17
- data/omniauth-auth0.gemspec +0 -2
- data/spec/omniauth/auth0/jwt_validator_spec.rb +450 -70
- data/spec/omniauth/auth0/telemetry_spec.rb +28 -0
- data/spec/omniauth/strategies/auth0_spec.rb +51 -1
- data/spec/spec_helper.rb +6 -4
- metadata +13 -5
- data/.travis.yml +0 -6
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
describe OmniAuth::Auth0::Telemetry do
|
5
|
+
|
6
|
+
let(:test_class) { Class.new.extend(OmniAuth::Auth0::Telemetry) }
|
7
|
+
|
8
|
+
describe 'telemetry' do
|
9
|
+
|
10
|
+
it 'should have the correct SDK name' do
|
11
|
+
expect(test_class.telemetry).to have_key(:name)
|
12
|
+
expect(test_class.telemetry[:name]).to eq('omniauth-auth0')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the correct SDK version' do
|
16
|
+
expect(test_class.telemetry).to have_key(:version)
|
17
|
+
expect(test_class.telemetry[:version]).to eq(OmniAuth::Auth0::VERSION)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should include the Ruby version' do
|
21
|
+
expect(test_class.telemetry).to have_key(:env)
|
22
|
+
expect(test_class.telemetry[:env]).to have_key(:ruby)
|
23
|
+
expect(test_class.telemetry[:env][:ruby]).to eq(RUBY_VERSION)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'jwt'
|
3
5
|
|
@@ -79,6 +81,11 @@ describe OmniAuth::Strategies::Auth0 do
|
|
79
81
|
expect(redirect_url).to have_query('state')
|
80
82
|
expect(redirect_url).to have_query('client_id')
|
81
83
|
expect(redirect_url).to have_query('redirect_uri')
|
84
|
+
expect(redirect_url).not_to have_query('auth0Client')
|
85
|
+
expect(redirect_url).not_to have_query('connection')
|
86
|
+
expect(redirect_url).not_to have_query('connection_scope')
|
87
|
+
expect(redirect_url).not_to have_query('prompt')
|
88
|
+
expect(redirect_url).not_to have_query('screen_hint')
|
82
89
|
end
|
83
90
|
|
84
91
|
it 'redirects to hosted login page' do
|
@@ -91,6 +98,47 @@ describe OmniAuth::Strategies::Auth0 do
|
|
91
98
|
expect(redirect_url).to have_query('client_id')
|
92
99
|
expect(redirect_url).to have_query('redirect_uri')
|
93
100
|
expect(redirect_url).to have_query('connection', 'abcd')
|
101
|
+
expect(redirect_url).not_to have_query('auth0Client')
|
102
|
+
expect(redirect_url).not_to have_query('connection_scope')
|
103
|
+
expect(redirect_url).not_to have_query('prompt')
|
104
|
+
expect(redirect_url).not_to have_query('screen_hint')
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'redirects to the hosted login page with connection_scope' do
|
108
|
+
get 'auth/auth0?connection_scope=identity_provider_scope'
|
109
|
+
expect(last_response.status).to eq(302)
|
110
|
+
redirect_url = last_response.headers['Location']
|
111
|
+
expect(redirect_url).to start_with('https://samples.auth0.com/authorize')
|
112
|
+
expect(redirect_url)
|
113
|
+
.to have_query('connection_scope', 'identity_provider_scope')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'redirects to hosted login page with prompt=login' do
|
117
|
+
get 'auth/auth0?prompt=login'
|
118
|
+
expect(last_response.status).to eq(302)
|
119
|
+
redirect_url = last_response.headers['Location']
|
120
|
+
expect(redirect_url).to start_with('https://samples.auth0.com/authorize')
|
121
|
+
expect(redirect_url).to have_query('response_type', 'code')
|
122
|
+
expect(redirect_url).to have_query('state')
|
123
|
+
expect(redirect_url).to have_query('client_id')
|
124
|
+
expect(redirect_url).to have_query('redirect_uri')
|
125
|
+
expect(redirect_url).to have_query('prompt', 'login')
|
126
|
+
expect(redirect_url).not_to have_query('auth0Client')
|
127
|
+
expect(redirect_url).not_to have_query('connection')
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'redirects to hosted login page with screen_hint=signup' do
|
131
|
+
get 'auth/auth0?screen_hint=signup'
|
132
|
+
expect(last_response.status).to eq(302)
|
133
|
+
redirect_url = last_response.headers['Location']
|
134
|
+
expect(redirect_url).to start_with('https://samples.auth0.com/authorize')
|
135
|
+
expect(redirect_url).to have_query('response_type', 'code')
|
136
|
+
expect(redirect_url).to have_query('state')
|
137
|
+
expect(redirect_url).to have_query('client_id')
|
138
|
+
expect(redirect_url).to have_query('redirect_uri')
|
139
|
+
expect(redirect_url).to have_query('screen_hint', 'signup')
|
140
|
+
expect(redirect_url).not_to have_query('auth0Client')
|
141
|
+
expect(redirect_url).not_to have_query('connection')
|
94
142
|
end
|
95
143
|
|
96
144
|
describe 'callback' do
|
@@ -98,6 +146,7 @@ describe OmniAuth::Strategies::Auth0 do
|
|
98
146
|
let(:expires_in) { 2000 }
|
99
147
|
let(:token_type) { 'bearer' }
|
100
148
|
let(:refresh_token) { 'refresh token' }
|
149
|
+
let(:telemetry_value) { Class.new.extend(OmniAuth::Auth0::Telemetry).telemetry_encoded }
|
101
150
|
|
102
151
|
let(:user_id) { 'user identifier' }
|
103
152
|
let(:state) { SecureRandom.hex(8) }
|
@@ -147,6 +196,7 @@ describe OmniAuth::Strategies::Auth0 do
|
|
147
196
|
|
148
197
|
def stub_auth(body)
|
149
198
|
stub_request(:post, 'https://samples.auth0.com/oauth/token')
|
199
|
+
.with(headers: { 'Auth0-Client' => telemetry_value })
|
150
200
|
.to_return(
|
151
201
|
headers: { 'Content-Type' => 'application/json' },
|
152
202
|
body: MultiJson.encode(body)
|
@@ -294,7 +344,7 @@ RSpec::Matchers.define :have_query do |key, value|
|
|
294
344
|
uri = redirect_uri(actual)
|
295
345
|
query = query(uri)
|
296
346
|
if value.nil?
|
297
|
-
query
|
347
|
+
query.key?(key)
|
298
348
|
else
|
299
349
|
query[key] == [value]
|
300
350
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,11 +2,13 @@ $LOAD_PATH.unshift File.expand_path(__dir__)
|
|
2
2
|
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
3
3
|
|
4
4
|
require 'simplecov'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
SimpleCov.start
|
6
|
+
|
7
|
+
if ENV['CI'] == 'true'
|
8
|
+
require 'codecov'
|
9
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
9
10
|
end
|
11
|
+
|
10
12
|
require 'rspec'
|
11
13
|
require 'rack/test'
|
12
14
|
require 'webmock/rspec'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Auth0
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -50,29 +50,37 @@ executables: []
|
|
50
50
|
extensions: []
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
|
+
- ".circleci/config.yml"
|
53
54
|
- ".gemrelease"
|
55
|
+
- ".github/CODEOWNERS"
|
54
56
|
- ".github/ISSUE_TEMPLATE.md"
|
55
57
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
58
|
+
- ".github/stale.yml"
|
56
59
|
- ".gitignore"
|
57
60
|
- ".rspec"
|
58
61
|
- ".rubocop.yml"
|
59
|
-
- ".
|
62
|
+
- ".snyk"
|
60
63
|
- CHANGELOG.md
|
61
64
|
- CODE_OF_CONDUCT.md
|
62
65
|
- CONTRIBUTING.md
|
63
66
|
- Gemfile
|
67
|
+
- Gemfile.lock
|
64
68
|
- Guardfile
|
65
69
|
- LICENSE
|
66
70
|
- README.md
|
67
71
|
- Rakefile
|
72
|
+
- codecov.yml
|
68
73
|
- examples/sinatra/app.rb
|
69
74
|
- examples/sinatra/config.ru
|
70
75
|
- lib/omniauth-auth0.rb
|
71
76
|
- lib/omniauth-auth0/version.rb
|
77
|
+
- lib/omniauth/auth0/errors.rb
|
72
78
|
- lib/omniauth/auth0/jwt_validator.rb
|
79
|
+
- lib/omniauth/auth0/telemetry.rb
|
73
80
|
- lib/omniauth/strategies/auth0.rb
|
74
81
|
- omniauth-auth0.gemspec
|
75
82
|
- spec/omniauth/auth0/jwt_validator_spec.rb
|
83
|
+
- spec/omniauth/auth0/telemetry_spec.rb
|
76
84
|
- spec/omniauth/strategies/auth0_spec.rb
|
77
85
|
- spec/resources/jwks.json
|
78
86
|
- spec/spec_helper.rb
|
@@ -95,13 +103,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
103
|
- !ruby/object:Gem::Version
|
96
104
|
version: '0'
|
97
105
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.7.7
|
106
|
+
rubygems_version: 3.1.2
|
100
107
|
signing_key:
|
101
108
|
specification_version: 4
|
102
109
|
summary: OmniAuth OAuth2 strategy for the Auth0 platform.
|
103
110
|
test_files:
|
104
111
|
- spec/omniauth/auth0/jwt_validator_spec.rb
|
112
|
+
- spec/omniauth/auth0/telemetry_spec.rb
|
105
113
|
- spec/omniauth/strategies/auth0_spec.rb
|
106
114
|
- spec/resources/jwks.json
|
107
115
|
- spec/spec_helper.rb
|