omniauth-auth0 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 934d8fc4286b19102f56b0ac05dce7cc655c4d93dc7e4808bcec7e208542ddce
4
- data.tar.gz: 9fc0b0a4060f90da65113c2123c69eb9d04566910afe942f7f9eb5bc0a172afa
3
+ metadata.gz: 463fae0687e0473a0918c9c2086f3b47a60ae1448fffa3b1157ec933784c1a1c
4
+ data.tar.gz: d872be3b458dadf3752d58192059d6d350a90f7047de1e84b98137417880204d
5
5
  SHA512:
6
- metadata.gz: 2bc7c98c7a6b411e2e1572a61e143ba949a02000ce153aa864ffd9c5211d7c36a32bbf6394c846e50c42d39836b2bee2d6ed4bd1d805f780d22e708a3597ca5c
7
- data.tar.gz: 0c2ba38df3e347b84c61e97db2b2d78a6aa1a3eabb5de04b27fb9dd1f0a04f60c6eb8858d1171f90b06ca4417e166bd1f9ab8fa3e49512029f7624b5636123db
6
+ metadata.gz: 13efc37572c71bdd5184dd9888e48f2479e5e5d52c16f454c01c88834fc2f5dffa3488b13b8b0dc9bbe423d9aa750038c12693f85e83f3375482af8857788585
7
+ data.tar.gz: 2240535e4f749e7ba47f587ca56ae9e1d5ee596e54391a969a5f282b852ab8f3a2970c99514014fada2d5a00b259144849e6e2db1ae559a8ab584753e4e7bce9
@@ -0,0 +1,49 @@
1
+ version: 2.1
2
+ jobs:
3
+ run-tests:
4
+ docker:
5
+ - image: circleci/ruby:2.4.6-jessie
6
+ steps:
7
+ - checkout
8
+ - restore_cache:
9
+ keys:
10
+ - gems-v2-{{ checksum "Gemfile.lock" }}
11
+ - gems-v2-
12
+ - run: bundle check || bundle install
13
+ - persist_to_workspace:
14
+ root: .
15
+ paths:
16
+ - Gemfile
17
+ - Gemfile.lock
18
+ - save_cache:
19
+ key: gems-v2--{{ checksum "Gemfile.lock" }}
20
+ paths:
21
+ - vendor/bundle
22
+ - run: bundle exec rake spec
23
+ snyk:
24
+ docker:
25
+ - image: snyk/snyk-cli:rubygems
26
+ steps:
27
+ - attach_workspace:
28
+ at: .
29
+ - run: snyk test
30
+ - run:
31
+ command: |
32
+ if [[ "${CIRCLE_BRANCH}" == "master" ]]
33
+ then
34
+ snyk monitor --org=auth0-sdks
35
+ fi
36
+ when: always
37
+
38
+ workflows:
39
+ tests:
40
+ jobs:
41
+ - run-tests
42
+ snyk:
43
+ jobs:
44
+ - run-tests
45
+ - snyk:
46
+ # Must define SNYK_TOKEN env
47
+ context: snyk-env
48
+ requires:
49
+ - run-tests
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  .ruby-version
2
2
  coverage
3
- Gemfile.lock
4
3
  *.gem
5
4
 
6
5
  .#*
@@ -10,4 +9,4 @@ tmp/
10
9
 
11
10
  ## Environment normalization:
12
11
  /.bundle
13
- /vendor/bundle
12
+ /vendor/bundle
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.2.0](https://github.com/auth0/omniauth-auth0/tree/v2.2.0) (2018-04-18)
4
+ [Full Changelog](https://github.com/auth0/omniauth-auth0/compare/v2.1.0...v2.2.0)
5
+
6
+ **Closed issues**
7
+ - It supports custom domain? [\#71](https://github.com/auth0/omniauth-auth0/issues/71)
8
+ - Valid Login, No Details: email=nil image=nil name="github|38257089" nickname=nil [\#70](https://github.com/auth0/omniauth-auth0/issues/70)
9
+
10
+ **Added**
11
+ - Custom issuer [\#77](https://github.com/auth0/omniauth-auth0/pull/77) ([ryan-rosenfeld](https://github.com/ryan-rosenfeld))
12
+ - Add telemetry to token endpoint [\#74](https://github.com/auth0/omniauth-auth0/pull/74) ([joshcanhelp](https://github.com/joshcanhelp))
13
+
14
+ **Changed**
15
+ - Remove telemetry from authorize URL [\#75](https://github.com/auth0/omniauth-auth0/pull/75) ([joshcanhelp](https://github.com/joshcanhelp))
16
+
3
17
  ## [v2.1.0](https://github.com/auth0/omniauth-auth0/tree/v2.1.0) (2018-10-30)
4
18
  [Full Changelog](https://github.com/auth0/omniauth-auth0/compare/v2.0.0...v2.1.0)
5
19
 
data/Gemfile CHANGED
@@ -9,10 +9,10 @@ gem 'rake'
9
9
  group :development do
10
10
  gem 'dotenv'
11
11
  gem 'pry'
12
+ gem 'rubocop', require: false
12
13
  gem 'shotgun'
13
14
  gem 'sinatra'
14
15
  gem 'thin'
15
- gem 'rubocop', require: false
16
16
  end
17
17
 
18
18
  group :test do
@@ -20,6 +20,7 @@ group :test do
20
20
  gem 'listen', '~> 3.1.5'
21
21
  gem 'rack-test'
22
22
  gem 'rspec', '~> 3.5'
23
+ gem 'codecov', require: false
23
24
  gem 'simplecov'
24
25
  gem 'webmock'
25
26
  end
@@ -0,0 +1,167 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-auth0 (2.2.0)
5
+ omniauth-oauth2 (~> 1.5)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.6.0)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ ast (2.4.0)
13
+ codecov (0.1.14)
14
+ json
15
+ simplecov
16
+ url
17
+ coderay (1.1.2)
18
+ crack (0.4.3)
19
+ safe_yaml (~> 1.0.0)
20
+ daemons (1.3.1)
21
+ diff-lcs (1.3)
22
+ docile (1.3.1)
23
+ dotenv (2.7.2)
24
+ eventmachine (1.2.7)
25
+ faraday (0.15.4)
26
+ multipart-post (>= 1.2, < 3)
27
+ ffi (1.10.0)
28
+ formatador (0.2.5)
29
+ gem-release (2.0.1)
30
+ guard (2.15.0)
31
+ formatador (>= 0.2.4)
32
+ listen (>= 2.7, < 4.0)
33
+ lumberjack (>= 1.0.12, < 2.0)
34
+ nenv (~> 0.1)
35
+ notiffany (~> 0.0)
36
+ pry (>= 0.9.12)
37
+ shellany (~> 0.0)
38
+ thor (>= 0.18.1)
39
+ guard-compat (1.2.1)
40
+ guard-rspec (4.7.3)
41
+ guard (~> 2.1)
42
+ guard-compat (~> 1.1)
43
+ rspec (>= 2.99.0, < 4.0)
44
+ hashdiff (0.3.8)
45
+ hashie (3.6.0)
46
+ jaro_winkler (1.5.2)
47
+ json (2.2.0)
48
+ jwt (2.1.0)
49
+ listen (3.1.5)
50
+ rb-fsevent (~> 0.9, >= 0.9.4)
51
+ rb-inotify (~> 0.9, >= 0.9.7)
52
+ ruby_dep (~> 1.2)
53
+ lumberjack (1.0.13)
54
+ method_source (0.9.2)
55
+ multi_json (1.13.1)
56
+ multi_xml (0.6.0)
57
+ multipart-post (2.0.0)
58
+ mustermann (1.0.3)
59
+ nenv (0.3.0)
60
+ notiffany (0.1.1)
61
+ nenv (~> 0.1)
62
+ shellany (~> 0.0)
63
+ oauth2 (1.4.1)
64
+ faraday (>= 0.8, < 0.16.0)
65
+ jwt (>= 1.0, < 3.0)
66
+ multi_json (~> 1.3)
67
+ multi_xml (~> 0.5)
68
+ rack (>= 1.2, < 3)
69
+ omniauth (1.9.0)
70
+ hashie (>= 3.4.6, < 3.7.0)
71
+ rack (>= 1.6.2, < 3)
72
+ omniauth-oauth2 (1.6.0)
73
+ oauth2 (~> 1.1)
74
+ omniauth (~> 1.9)
75
+ parallel (1.17.0)
76
+ parser (2.6.2.1)
77
+ ast (~> 2.4.0)
78
+ pry (0.12.2)
79
+ coderay (~> 1.1.0)
80
+ method_source (~> 0.9.0)
81
+ psych (3.1.0)
82
+ public_suffix (3.0.3)
83
+ rack (2.0.7)
84
+ rack-protection (2.0.5)
85
+ rack
86
+ rack-test (1.1.0)
87
+ rack (>= 1.0, < 3)
88
+ rainbow (3.0.0)
89
+ rake (12.3.2)
90
+ rb-fsevent (0.10.3)
91
+ rb-inotify (0.10.0)
92
+ ffi (~> 1.0)
93
+ rspec (3.8.0)
94
+ rspec-core (~> 3.8.0)
95
+ rspec-expectations (~> 3.8.0)
96
+ rspec-mocks (~> 3.8.0)
97
+ rspec-core (3.8.0)
98
+ rspec-support (~> 3.8.0)
99
+ rspec-expectations (3.8.2)
100
+ diff-lcs (>= 1.2.0, < 2.0)
101
+ rspec-support (~> 3.8.0)
102
+ rspec-mocks (3.8.0)
103
+ diff-lcs (>= 1.2.0, < 2.0)
104
+ rspec-support (~> 3.8.0)
105
+ rspec-support (3.8.0)
106
+ rubocop (0.67.2)
107
+ jaro_winkler (~> 1.5.1)
108
+ parallel (~> 1.10)
109
+ parser (>= 2.5, != 2.5.1.1)
110
+ psych (>= 3.1.0)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ ruby-progressbar (~> 1.7)
113
+ unicode-display_width (>= 1.4.0, < 1.6)
114
+ ruby-progressbar (1.10.0)
115
+ ruby_dep (1.5.0)
116
+ safe_yaml (1.0.5)
117
+ shellany (0.0.1)
118
+ shotgun (0.9.2)
119
+ rack (>= 1.0)
120
+ simplecov (0.16.1)
121
+ docile (~> 1.1)
122
+ json (>= 1.8, < 3)
123
+ simplecov-html (~> 0.10.0)
124
+ simplecov-html (0.10.2)
125
+ sinatra (2.0.5)
126
+ mustermann (~> 1.0)
127
+ rack (~> 2.0)
128
+ rack-protection (= 2.0.5)
129
+ tilt (~> 2.0)
130
+ thin (1.7.2)
131
+ daemons (~> 1.0, >= 1.0.9)
132
+ eventmachine (~> 1.0, >= 1.0.4)
133
+ rack (>= 1, < 3)
134
+ thor (0.20.3)
135
+ tilt (2.0.9)
136
+ unicode-display_width (1.5.0)
137
+ url (0.3.2)
138
+ webmock (3.5.1)
139
+ addressable (>= 2.3.6)
140
+ crack (>= 0.3.2)
141
+ hashdiff
142
+
143
+ PLATFORMS
144
+ ruby
145
+
146
+ DEPENDENCIES
147
+ bundler (~> 1.9)
148
+ codecov
149
+ dotenv
150
+ gem-release
151
+ guard-rspec
152
+ jwt
153
+ listen (~> 3.1.5)
154
+ omniauth-auth0!
155
+ pry
156
+ rack-test
157
+ rake
158
+ rspec (~> 3.5)
159
+ rubocop
160
+ shotgun
161
+ simplecov
162
+ sinatra
163
+ thin
164
+ webmock
165
+
166
+ BUNDLED WITH
167
+ 1.17.3
data/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  An [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating with [Auth0](https://auth0.com). This strategy is based on the [OmniAuth OAuth2](https://github.com/omniauth/omniauth-oauth2) strategy.
4
4
 
5
- [![Build Status](https://travis-ci.org/auth0/omniauth-auth0.svg)](https://travis-ci.org/auth0/omniauth-auth0)
6
- [![Gem Version](https://badge.fury.io/rb/auth0.svg)](http://badge.fury.io/rb/auth0)
7
- [![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/auth0/ruby-auth0/blob/master/LICENSE)
5
+ [![CircleCI](https://img.shields.io/circleci/project/github/auth0/omniauth-auth0/master.svg)](https://circleci.com/gh/auth0/omniauth-auth0)
6
+ [![codecov](https://codecov.io/gh/auth0/omniauth-auth0/branch/master/graph/badge.svg)](https://codecov.io/gh/auth0/omniauth-auth0)
7
+ [![Gem Version](https://badge.fury.io/rb/omniauth-auth0.svg)](https://badge.fury.io/rb/omniauth-auth0)
8
+ [![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/auth0/omniauth-auth0/blob/master/LICENSE)
8
9
 
9
10
  ## Table of Contents
10
11
 
@@ -0,0 +1,22 @@
1
+ coverage:
2
+ precision: 2
3
+ round: down
4
+ range: "60...100"
5
+ status:
6
+ project:
7
+ default:
8
+ enabled: true
9
+ target: auto
10
+ threshold: 5%
11
+ if_no_uploads: error
12
+ patch:
13
+ default:
14
+ enabled: true
15
+ target: 80%
16
+ threshold: 30%
17
+ if_no_uploads: error
18
+ changes:
19
+ default:
20
+ enabled: true
21
+ if_no_uploads: error
22
+ comment: false
@@ -1,2 +1,2 @@
1
- require 'omniauth-auth0/version' # rubocop:disable Style/FileName
1
+ require 'omniauth-auth0/version'
2
2
  require 'omniauth/strategies/auth0'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Auth0
3
- VERSION = '2.1.0'.freeze
3
+ VERSION = '2.2.0'.freeze
4
4
  end
5
5
  end
@@ -7,17 +7,20 @@ module OmniAuth
7
7
  module Auth0
8
8
  # JWT Validator class
9
9
  class JWTValidator
10
- attr_accessor :issuer
10
+ attr_accessor :issuer, :domain
11
11
 
12
12
  # Initializer
13
13
  # @param options object
14
14
  # options.domain - Application domain.
15
+ # options.issuer - Application issuer (optional).
15
16
  # options.client_id - Application Client ID.
16
17
  # options.client_secret - Application Client Secret.
17
18
  def initialize(options)
18
- temp_domain = URI(options.domain)
19
- temp_domain = URI("https://#{options.domain}") unless temp_domain.scheme
20
- @issuer = "#{temp_domain}/"
19
+ @domain = uri_string(options.domain)
20
+
21
+ # Use custom issuer if provided, otherwise use domain
22
+ @issuer = @domain
23
+ @issuer = uri_string(options.issuer) if options.respond_to?(:issuer)
21
24
 
22
25
  @client_id = options.client_id
23
26
  @client_secret = options.client_secret
@@ -97,10 +100,10 @@ module OmniAuth
97
100
  jwks_public_cert(jwks_x5c.first)
98
101
  end
99
102
 
100
- # Get a JWKS from the issuer
103
+ # Get a JWKS from the domain
101
104
  # @return void
102
105
  def jwks
103
- jwks_uri = URI(@issuer + '.well-known/jwks.json')
106
+ jwks_uri = URI(@domain + '.well-known/jwks.json')
104
107
  @jwks ||= json_parse(Net::HTTP.get(jwks_uri))
105
108
  end
106
109
 
@@ -117,6 +120,15 @@ module OmniAuth
117
120
  def json_parse(json)
118
121
  JSON.parse(json, symbolize_names: true)
119
122
  end
123
+
124
+ # Parse a URI into the desired string format
125
+ # @param uri - the URI to parse
126
+ # @return string
127
+ def uri_string(uri)
128
+ temp_domain = URI(uri)
129
+ temp_domain = URI("https://#{uri}") unless temp_domain.scheme
130
+ "#{temp_domain}/"
131
+ end
120
132
  end
121
133
  end
122
134
  end
@@ -0,0 +1,36 @@
1
+ require 'json'
2
+
3
+ module OmniAuth
4
+ module Auth0
5
+ # Module to provide necessary telemetry for API requests.
6
+ module Telemetry
7
+
8
+ # Return a telemetry hash to be encoded and sent to Auth0.
9
+ # @return hash
10
+ def telemetry
11
+ telemetry = {
12
+ name: 'omniauth-auth0',
13
+ version: OmniAuth::Auth0::VERSION,
14
+ env: {
15
+ ruby: RUBY_VERSION
16
+ }
17
+ }
18
+ add_rails_version telemetry
19
+ end
20
+
21
+ # JSON-ify and base64 encode the current telemetry.
22
+ # @return string
23
+ def telemetry_encoded
24
+ Base64.urlsafe_encode64(JSON.dump(telemetry))
25
+ end
26
+
27
+ private
28
+
29
+ def add_rails_version(telemetry)
30
+ return telemetry unless Gem.loaded_specs['rails'].respond_to? :version
31
+ telemetry[:env][:rails] = Gem.loaded_specs['rails'].version.to_s
32
+ telemetry
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,12 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
  require 'uri'
3
5
  require 'omniauth-oauth2'
4
6
  require 'omniauth/auth0/jwt_validator'
7
+ require 'omniauth/auth0/telemetry'
5
8
 
6
9
  module OmniAuth
7
10
  module Strategies
8
11
  # Auth0 OmniAuth strategy
9
12
  class Auth0 < OmniAuth::Strategies::OAuth2
13
+ include OmniAuth::Auth0::Telemetry
14
+
10
15
  option :name, 'auth0'
11
16
 
12
17
  args %i[
@@ -72,13 +77,17 @@ module OmniAuth
72
77
  # Define the parameters used for the /authorize endpoint
73
78
  def authorize_params
74
79
  params = super
75
- params['auth0Client'] = client_info
76
- parse_query = Rack::Utils.parse_query(request.query_string)
77
- params['connection'] = parse_query['connection']
78
- params['prompt'] = parse_query['prompt']
80
+ parsed_query = Rack::Utils.parse_query(request.query_string)
81
+ params['connection'] = parsed_query['connection']
82
+ params['prompt'] = parsed_query['prompt']
79
83
  params
80
84
  end
81
85
 
86
+ def build_access_token
87
+ options.token_params[:headers] = { 'Auth0-Client' => telemetry_encoded }
88
+ super
89
+ end
90
+
82
91
  # Declarative override for the request phase of authentication
83
92
  def request_phase
84
93
  if no_client_id?
@@ -125,15 +134,6 @@ module OmniAuth
125
134
  domain_url = URI("https://#{domain_url}") if domain_url.scheme.nil?
126
135
  domain_url.to_s
127
136
  end
128
-
129
- # Build the auth0Client URL parameter for metrics.
130
- def client_info
131
- client_info = JSON.dump(
132
- name: 'omniauth-auth0',
133
- version: OmniAuth::Auth0::VERSION
134
- )
135
- Base64.urlsafe_encode64(client_info)
136
- end
137
137
  end
138
138
  end
139
139
  end
@@ -35,8 +35,6 @@ describe OmniAuth::Auth0::JWTValidator do
35
35
  JSON.parse(jwks_file, symbolize_names: true)
36
36
  end
37
37
 
38
- Options = Struct.new(:domain, :client_id, :client_secret)
39
-
40
38
  #
41
39
  # Specs
42
40
  #
@@ -119,6 +117,36 @@ describe OmniAuth::Auth0::JWTValidator do
119
117
  end
120
118
  end
121
119
 
120
+ describe 'JWT verifier custom issuer' do
121
+ context 'same as domain' do
122
+ let(:jwt_validator) do
123
+ make_jwt_validator(opt_issuer: domain)
124
+ end
125
+
126
+ it 'should have the correct issuer' do
127
+ expect(jwt_validator.issuer).to eq('https://samples.auth0.com/')
128
+ end
129
+
130
+ it 'should have the correct domain' do
131
+ expect(jwt_validator.issuer).to eq('https://samples.auth0.com/')
132
+ end
133
+ end
134
+
135
+ context 'different from domain' do
136
+ let(:jwt_validator) do
137
+ make_jwt_validator(opt_issuer: 'different.auth0.com')
138
+ end
139
+
140
+ it 'should have the correct issuer' do
141
+ expect(jwt_validator.issuer).to eq('https://different.auth0.com/')
142
+ end
143
+
144
+ it 'should have the correct domain' do
145
+ expect(jwt_validator.domain).to eq('https://samples.auth0.com/')
146
+ end
147
+ end
148
+ end
149
+
122
150
  describe 'JWT verifier decode' do
123
151
  let(:jwt_validator) do
124
152
  make_jwt_validator
@@ -225,21 +253,22 @@ describe OmniAuth::Auth0::JWTValidator do
225
253
  kid: jwks_kid
226
254
  }
227
255
  token = make_rs256_token(payload)
228
- decoded_token = make_jwt_validator(domain).decode(token)
256
+ decoded_token = make_jwt_validator(opt_domain: domain).decode(token)
229
257
  expect(decoded_token.first['sub']).to eq(sub)
230
258
  end
231
259
  end
232
260
 
233
261
  private
234
262
 
235
- def make_jwt_validator(opt_domain = domain)
236
- OmniAuth::Auth0::JWTValidator.new(
237
- Options.new(
238
- opt_domain,
239
- client_id,
240
- client_secret
241
- )
263
+ def make_jwt_validator(opt_domain: domain, opt_issuer: nil)
264
+ opts = OpenStruct.new(
265
+ domain: opt_domain,
266
+ client_id: client_id,
267
+ client_secret: client_secret
242
268
  )
269
+ opts[:issuer] = opt_issuer unless opt_issuer.nil?
270
+
271
+ OmniAuth::Auth0::JWTValidator.new(opts)
243
272
  end
244
273
 
245
274
  def make_hs256_token(payload = nil)
@@ -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,7 @@ 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')
82
85
  end
83
86
 
84
87
  it 'redirects to hosted login page' do
@@ -91,6 +94,7 @@ describe OmniAuth::Strategies::Auth0 do
91
94
  expect(redirect_url).to have_query('client_id')
92
95
  expect(redirect_url).to have_query('redirect_uri')
93
96
  expect(redirect_url).to have_query('connection', 'abcd')
97
+ expect(redirect_url).not_to have_query('auth0Client')
94
98
  end
95
99
 
96
100
  describe 'callback' do
@@ -98,6 +102,7 @@ describe OmniAuth::Strategies::Auth0 do
98
102
  let(:expires_in) { 2000 }
99
103
  let(:token_type) { 'bearer' }
100
104
  let(:refresh_token) { 'refresh token' }
105
+ let(:telemetry_value) { Class.new.extend(OmniAuth::Auth0::Telemetry).telemetry_encoded }
101
106
 
102
107
  let(:user_id) { 'user identifier' }
103
108
  let(:state) { SecureRandom.hex(8) }
@@ -147,6 +152,7 @@ describe OmniAuth::Strategies::Auth0 do
147
152
 
148
153
  def stub_auth(body)
149
154
  stub_request(:post, 'https://samples.auth0.com/oauth/token')
155
+ .with(headers: { 'Auth0-Client' => telemetry_value })
150
156
  .to_return(
151
157
  headers: { 'Content-Type' => 'application/json' },
152
158
  body: MultiJson.encode(body)
@@ -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
- if ENV['COVERAGE']
6
- SimpleCov.start do
7
- minimum_coverage(89.8)
8
- end
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.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2019-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -50,29 +50,33 @@ executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
+ - ".circleci/config.yml"
53
54
  - ".gemrelease"
54
55
  - ".github/ISSUE_TEMPLATE.md"
55
56
  - ".github/PULL_REQUEST_TEMPLATE.md"
56
57
  - ".gitignore"
57
58
  - ".rspec"
58
59
  - ".rubocop.yml"
59
- - ".travis.yml"
60
60
  - CHANGELOG.md
61
61
  - CODE_OF_CONDUCT.md
62
62
  - CONTRIBUTING.md
63
63
  - Gemfile
64
+ - Gemfile.lock
64
65
  - Guardfile
65
66
  - LICENSE
66
67
  - README.md
67
68
  - Rakefile
69
+ - codecov.yml
68
70
  - examples/sinatra/app.rb
69
71
  - examples/sinatra/config.ru
70
72
  - lib/omniauth-auth0.rb
71
73
  - lib/omniauth-auth0/version.rb
72
74
  - lib/omniauth/auth0/jwt_validator.rb
75
+ - lib/omniauth/auth0/telemetry.rb
73
76
  - lib/omniauth/strategies/auth0.rb
74
77
  - omniauth-auth0.gemspec
75
78
  - spec/omniauth/auth0/jwt_validator_spec.rb
79
+ - spec/omniauth/auth0/telemetry_spec.rb
76
80
  - spec/omniauth/strategies/auth0_spec.rb
77
81
  - spec/resources/jwks.json
78
82
  - spec/spec_helper.rb
@@ -95,13 +99,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
99
  - !ruby/object:Gem::Version
96
100
  version: '0'
97
101
  requirements: []
98
- rubyforge_project: omniauth-auth0
99
- rubygems_version: 2.7.7
102
+ rubygems_version: 3.0.3
100
103
  signing_key:
101
104
  specification_version: 4
102
105
  summary: OmniAuth OAuth2 strategy for the Auth0 platform.
103
106
  test_files:
104
107
  - spec/omniauth/auth0/jwt_validator_spec.rb
108
+ - spec/omniauth/auth0/telemetry_spec.rb
105
109
  - spec/omniauth/strategies/auth0_spec.rb
106
110
  - spec/resources/jwks.json
107
111
  - spec/spec_helper.rb
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.5
4
- branches:
5
- only:
6
- - master