omniauth-auth0 2.6.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,180 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-auth0 (3.1.0)
5
+ omniauth (~> 2)
6
+ omniauth-oauth2 (~> 1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ coderay (1.1.3)
15
+ crack (0.4.5)
16
+ rexml
17
+ daemons (1.4.1)
18
+ diff-lcs (1.5.0)
19
+ docile (1.4.0)
20
+ dotenv (2.8.1)
21
+ eventmachine (1.2.7)
22
+ faraday (2.7.1)
23
+ faraday-net_http (>= 2.0, < 3.1)
24
+ ruby2_keywords (>= 0.0.4)
25
+ faraday-net_http (3.0.2)
26
+ ffi (1.15.5)
27
+ formatador (1.1.0)
28
+ gem-release (2.2.2)
29
+ guard (2.18.0)
30
+ formatador (>= 0.2.4)
31
+ listen (>= 2.7, < 4.0)
32
+ lumberjack (>= 1.0.12, < 2.0)
33
+ nenv (~> 0.1)
34
+ notiffany (~> 0.0)
35
+ pry (>= 0.13.0)
36
+ shellany (~> 0.0)
37
+ thor (>= 0.18.1)
38
+ guard-compat (1.2.1)
39
+ guard-rspec (4.7.3)
40
+ guard (~> 2.1)
41
+ guard-compat (~> 1.1)
42
+ rspec (>= 2.99.0, < 4.0)
43
+ hashdiff (1.0.1)
44
+ hashie (5.0.0)
45
+ json (2.6.3)
46
+ jwt (2.5.0)
47
+ listen (3.7.1)
48
+ rb-fsevent (~> 0.10, >= 0.10.3)
49
+ rb-inotify (~> 0.9, >= 0.9.10)
50
+ lumberjack (1.2.8)
51
+ method_source (1.0.0)
52
+ multi_json (1.15.0)
53
+ multi_xml (0.6.0)
54
+ mustermann (2.0.2)
55
+ ruby2_keywords (~> 0.0.1)
56
+ nenv (0.3.0)
57
+ notiffany (0.1.3)
58
+ nenv (~> 0.1)
59
+ shellany (~> 0.0)
60
+ oauth2 (2.0.9)
61
+ faraday (>= 0.17.3, < 3.0)
62
+ jwt (>= 1.0, < 3.0)
63
+ multi_xml (~> 0.5)
64
+ rack (>= 1.2, < 4)
65
+ snaky_hash (~> 2.0)
66
+ version_gem (~> 1.1)
67
+ omniauth (2.1.0)
68
+ hashie (>= 3.4.6)
69
+ rack (>= 2.2.3)
70
+ rack-protection
71
+ omniauth-oauth2 (1.8.0)
72
+ oauth2 (>= 1.4, < 3)
73
+ omniauth (~> 2.0)
74
+ parallel (1.22.1)
75
+ parser (3.1.3.0)
76
+ ast (~> 2.4.1)
77
+ pry (0.14.1)
78
+ coderay (~> 1.1)
79
+ method_source (~> 1.0)
80
+ public_suffix (5.0.0)
81
+ rack (2.2.4)
82
+ rack-protection (2.2.3)
83
+ rack
84
+ rack-test (2.0.2)
85
+ rack (>= 1.3)
86
+ rainbow (3.1.1)
87
+ rake (13.0.6)
88
+ rb-fsevent (0.11.2)
89
+ rb-inotify (0.10.1)
90
+ ffi (~> 1.0)
91
+ regexp_parser (2.6.1)
92
+ rexml (3.2.5)
93
+ rspec (3.12.0)
94
+ rspec-core (~> 3.12.0)
95
+ rspec-expectations (~> 3.12.0)
96
+ rspec-mocks (~> 3.12.0)
97
+ rspec-core (3.12.0)
98
+ rspec-support (~> 3.12.0)
99
+ rspec-expectations (3.12.0)
100
+ diff-lcs (>= 1.2.0, < 2.0)
101
+ rspec-support (~> 3.12.0)
102
+ rspec-mocks (3.12.0)
103
+ diff-lcs (>= 1.2.0, < 2.0)
104
+ rspec-support (~> 3.12.0)
105
+ rspec-support (3.12.0)
106
+ rubocop (1.39.0)
107
+ json (~> 2.3)
108
+ parallel (~> 1.10)
109
+ parser (>= 3.1.2.1)
110
+ rainbow (>= 2.2.2, < 4.0)
111
+ regexp_parser (>= 1.8, < 3.0)
112
+ rexml (>= 3.2.5, < 4.0)
113
+ rubocop-ast (>= 1.23.0, < 2.0)
114
+ ruby-progressbar (~> 1.7)
115
+ unicode-display_width (>= 1.4.0, < 3.0)
116
+ rubocop-ast (1.24.0)
117
+ parser (>= 3.1.1.0)
118
+ ruby-progressbar (1.11.0)
119
+ ruby2_keywords (0.0.5)
120
+ shellany (0.0.1)
121
+ shotgun (0.9.2)
122
+ rack (>= 1.0)
123
+ simplecov (0.21.2)
124
+ docile (~> 1.1)
125
+ simplecov-html (~> 0.11)
126
+ simplecov_json_formatter (~> 0.1)
127
+ simplecov-cobertura (2.1.0)
128
+ rexml
129
+ simplecov (~> 0.19)
130
+ simplecov-html (0.12.3)
131
+ simplecov_json_formatter (0.1.4)
132
+ sinatra (2.2.3)
133
+ mustermann (~> 2.0)
134
+ rack (~> 2.2)
135
+ rack-protection (= 2.2.3)
136
+ tilt (~> 2.0)
137
+ snaky_hash (2.0.1)
138
+ hashie
139
+ version_gem (~> 1.1, >= 1.1.1)
140
+ thin (1.8.1)
141
+ daemons (~> 1.0, >= 1.0.9)
142
+ eventmachine (~> 1.0, >= 1.0.4)
143
+ rack (>= 1, < 3)
144
+ thor (1.2.1)
145
+ tilt (2.0.11)
146
+ unicode-display_width (2.3.0)
147
+ version_gem (1.1.1)
148
+ webmock (3.18.1)
149
+ addressable (>= 2.8.0)
150
+ crack (>= 0.3.2)
151
+ hashdiff (>= 0.4.0, < 2.0.0)
152
+
153
+ PLATFORMS
154
+ arm64-darwin-21
155
+ x86_64-darwin-20
156
+ x86_64-darwin-21
157
+ x86_64-linux
158
+
159
+ DEPENDENCIES
160
+ bundler
161
+ dotenv (~> 2)
162
+ gem-release (~> 2)
163
+ guard-rspec (~> 4)
164
+ jwt (~> 2)
165
+ listen (~> 3)
166
+ multi_json (~> 1)
167
+ omniauth-auth0!
168
+ pry (~> 0)
169
+ rack-test (~> 2)
170
+ rake (~> 13)
171
+ rspec (~> 3)
172
+ rubocop (~> 1)
173
+ shotgun (~> 0)
174
+ simplecov-cobertura (~> 2)
175
+ sinatra (~> 2)
176
+ thin (~> 1)
177
+ webmock (~> 3)
178
+
179
+ BUNDLED WITH
180
+ 2.3.7
data/README.md CHANGED
@@ -1,25 +1,14 @@
1
- # OmniAuth Auth0
1
+ ![Omniauth-auth0](https://cdn.auth0.com/website/sdks/banners/omniauth-auth0-banner.png)
2
2
 
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
-
5
- > :warning: **Important security note:** This solution uses a 3rd party library with an unresolved [security issue(s)](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-9284). Please review the details of the vulnerability, including [Auth0](https://github.com/auth0/omniauth-auth0/issues/82 ) and other recommended [mitigations](https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284), before implementing the solution.
6
3
 
7
4
  [![CircleCI](https://img.shields.io/circleci/project/github/auth0/omniauth-auth0/master.svg)](https://circleci.com/gh/auth0/omniauth-auth0)
8
5
  [![codecov](https://codecov.io/gh/auth0/omniauth-auth0/branch/master/graph/badge.svg)](https://codecov.io/gh/auth0/omniauth-auth0)
9
6
  [![Gem Version](https://badge.fury.io/rb/omniauth-auth0.svg)](https://badge.fury.io/rb/omniauth-auth0)
10
7
  [![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/auth0/omniauth-auth0/blob/master/LICENSE)
11
- [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fauth0%2Fomniauth-auth0.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fomniauth-auth0?ref=badge_shield)
12
-
13
- ## Table of Contents
14
8
 
15
- - [Documentation](#documentation)
16
- - [Installation](#installation)
17
- - [Getting Started](#getting-started)
18
- - [Contribution](#contribution)
19
- - [Support + Feedback](#support--feedback)
20
- - [Vulnerability Reporting](#vulnerability-reporting)
21
- - [What is Auth0](#what-is-auth0)
22
- - [License](#license)
9
+ <div>
10
+ 📚 <a href="#documentation">Documentation</a> - 🚀 <a href="#getting-started">Getting started</a> - 💻 <a href="https://www.rubydoc.info/gems/omniauth-auth0">API reference</a> - 💬 <a href="#feedback">Feedback</a>
11
+ </div>
23
12
 
24
13
  ## Documentation
25
14
 
@@ -27,7 +16,9 @@ An [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating
27
16
  - [Sample projects](https://github.com/auth0-samples/auth0-rubyonrails-sample)
28
17
  - [API Reference](https://www.rubydoc.info/gems/omniauth-auth0)
29
18
 
30
- ## Installation
19
+ ## Getting started
20
+
21
+ ### Installation
31
22
 
32
23
  Add the following line to your `Gemfile`:
33
24
 
@@ -49,194 +40,129 @@ $ bundle install
49
40
 
50
41
  See our [contributing guide](CONTRIBUTING.md) for information on local installation for development.
51
42
 
52
- ## Getting Started
43
+ ## Configure the SDK
53
44
 
54
- To start processing authentication requests, the following steps must be performed:
45
+ Adding the SDK to your Rails app requires a few steps:
55
46
 
56
- 1. Initialize the strategy
57
- 2. Configure the callback controller
58
- 3. Add the required routes
59
- 4. Trigger an authentication request
47
+ - [Create the configuration file](#create-the-configuration-file)
48
+ - [Create the initializer](#create-the-initializer)
49
+ - [Create the callback controller](#create-the-callback-controller)
50
+ - [Add routes](#add-routes)
60
51
 
61
- All of these tasks and more are covered in our [Ruby on Rails Quickstart](https://auth0.com/docs/quickstart/webapp/rails).
52
+ ### Create the configuration file
62
53
 
63
- ### Additional authentication parameters
54
+ Create the file `./config/auth0.yml` within your application directory with the following content:
64
55
 
65
- To send additional parameters during login, you can specify them when you register the provider:
66
-
67
- ```ruby
68
- provider
69
- :auth0,
70
- ENV['AUTH0_CLIENT_ID'],
71
- ENV['AUTH0_CLIENT_SECRET'],
72
- ENV['AUTH0_DOMAIN'],
73
- {
74
- authorize_params: {
75
- scope: 'openid read:users write:order',
76
- audience: 'https://mydomain/api',
77
- max_age: 3600 # time in seconds authentication is valid
78
- }
79
- }
56
+ ```yml
57
+ development:
58
+ auth0_domain: <YOUR_DOMAIN>
59
+ auth0_client_id: <YOUR_CLIENT_ID>
60
+ auth0_client_secret: <YOUR AUTH0 CLIENT SECRET>
80
61
  ```
81
62
 
82
- ... which will tell the strategy to send those parameters on every authentication request.
83
-
84
- ### Authentication hash
85
-
86
- The Auth0 strategy will provide the standard OmniAuth hash attributes:
63
+ ### Create the initializer
87
64
 
88
- - `:provider` - the name of the strategy, in this case `auth0`
89
- - `:uid` - the user identifier
90
- - `:info` - the result of the call to `/userinfo` using OmniAuth standard attributes
91
- - `:credentials` - tokens requested and data
92
- - `:extra` - Additional info obtained from calling `/userinfo` in the `:raw_info` property
65
+ Create a new Ruby file in `./config/initializers/auth0.rb` to configure the OmniAuth middleware:
93
66
 
94
67
  ```ruby
95
- {
96
- :provider => 'auth0',
97
- :uid => 'auth0|USER_ID',
98
- :info => {
99
- :name => 'John Foo',
100
- :email => 'johnfoo@example.org',
101
- :nickname => 'john',
102
- :image => 'https://example.org/john.jpg'
103
- },
104
- :credentials => {
105
- :token => 'ACCESS_TOKEN',
106
- :expires_at => 1485373937,
107
- :expires => true,
108
- :refresh_token => 'REFRESH_TOKEN',
109
- :id_token => 'JWT_ID_TOKEN',
110
- :token_type => 'bearer',
111
- },
112
- :extra => {
113
- :raw_info => {
114
- :email => 'johnfoo@example.org',
115
- :email_verified => 'true',
116
- :name => 'John Foo',
117
- :picture => 'https://example.org/john.jpg',
118
- :user_id => 'auth0|USER_ID',
119
- :nickname => 'john',
120
- :created_at => '2014-07-15T17:19:50.387Z'
68
+ AUTH0_CONFIG = Rails.application.config_for(:auth0)
69
+
70
+ Rails.application.config.middleware.use OmniAuth::Builder do
71
+ provider(
72
+ :auth0,
73
+ AUTH0_CONFIG['auth0_client_id'],
74
+ AUTH0_CONFIG['auth0_client_secret'],
75
+ AUTH0_CONFIG['auth0_domain'],
76
+ callback_path: '/auth/auth0/callback',
77
+ authorize_params: {
78
+ scope: 'openid profile'
121
79
  }
122
- }
123
- }
80
+ )
81
+ end
124
82
  ```
125
83
 
126
- ### Query Parameter Options
127
-
128
- In some scenarios, you may need to pass specific query parameters to `/authorize`. The following parameters are available to enable this:
129
-
130
- - `connection`
131
- - `connection_scope`
132
- - `prompt`
133
- - `screen_hint` (only relevant to New Universal Login Experience)
134
- - `organization`
135
- - `invitation`
136
-
137
- Simply pass these query parameters to your OmniAuth redirect endpoint to enable their behavior.
138
-
139
- ## Examples
140
-
141
- ### Auth0 Organizations (Closed Beta)
142
-
143
- Organizations is a set of features that provide better support for developers who build and maintain SaaS and Business-to-Business (B2B) applications.
144
-
145
- Using Organizations, you can:
84
+ ### Create the callback controller
146
85
 
147
- - Represent teams, business customers, partner companies, or any logical grouping of users that should have different ways of accessing your applications, as organizations.
148
- - Manage their membership in a variety of ways, including user invitation.
149
- - Configure branded, federated login flows for each organization.
150
- - Implement role-based access control, such that users can have different roles when authenticating in the context of different organizations.
151
- - Build administration capabilities into your products, using Organizations APIs, so that those businesses can manage their own organizations.
86
+ Create a new controller `./app/controllers/auth0_controller.rb` to handle the callback from Auth0.
152
87
 
153
- Note that Organizations is currently only available to customers on our Enterprise and Startup subscription plans.
154
-
155
- #### Logging in with an Organization
156
-
157
- Logging in with an Organization is as easy as passing the parameters to the authorize endpoint. You can do this with
88
+ > You can also run `rails generate controller auth0 callback failure logout --skip-assets --skip-helper --skip-routes --skip-template-engine` to scaffold this controller for you.
158
89
 
159
90
  ```ruby
160
- <%=
161
- button_to 'Login', 'auth/auth0',
162
- method: :post,
163
- params: {
164
- # Found in your Auth0 dashboard, under Organization settings:
165
- organization: '{AUTH0_ORGANIZATION}'
166
- }
167
- %>
168
- ```
169
-
170
- Alternatively you can configure the organization when you register the provider:
171
-
172
- ```ruby
173
- provider
174
- :auth0,
175
- ENV['AUTH0_CLIENT_ID'],
176
- ENV['AUTH0_CLIENT_SECRET'],
177
- ENV['AUTH0_DOMAIN'],
178
- {
179
- authorize_params: {
180
- scope: 'openid read:users',
181
- audience: 'https://{AUTH0_DOMAIN}/api',
182
- organization: '{AUTH0_ORGANIZATION}'
183
- }
184
- }
91
+ # ./app/controllers/auth0_controller.rb
92
+ class Auth0Controller < ApplicationController
93
+ def callback
94
+ # OmniAuth stores the information returned from Auth0 and the IdP in request.env['omniauth.auth'].
95
+ # In this code, you will pull the raw_info supplied from the id_token and assign it to the session.
96
+ # Refer to https://github.com/auth0/omniauth-auth0/blob/master/EXAMPLES.md#example-of-the-resulting-authentication-hash for complete information on 'omniauth.auth' contents.
97
+ auth_info = request.env['omniauth.auth']
98
+ session[:userinfo] = auth_info['extra']['raw_info']
99
+
100
+ # Redirect to the URL you want after successful auth
101
+ redirect_to '/dashboard'
102
+ end
103
+
104
+ def failure
105
+ # Handles failed authentication -- Show a failure page (you can also handle with a redirect)
106
+ @error_msg = request.params['message']
107
+ end
108
+
109
+ def logout
110
+ # you will finish this in a later step
111
+ end
112
+ end
185
113
  ```
186
114
 
187
- #### Accepting user invitations
115
+ ### Add routes
188
116
 
189
- Auth0 Organizations allow users to be invited using emailed links, which will direct a user back to your application. The URL the user will arrive at is based on your configured `Application Login URI`, which you can change from your Application's settings inside the Auth0 dashboard.
190
-
191
- When the user arrives at your application using an invite link, you can expect three query parameters to be provided: `invitation`, `organization`, and `organization_name`. These will always be delivered using a GET request.
192
-
193
- You can then supply those parametrs to a `button_to` or `link_to` helper
117
+ Finally, add the following routes to your `./config/routes.rb` file:
194
118
 
195
119
  ```ruby
196
- <%=
197
- button_to 'Login', 'auth/auth0',
198
- method: :post,
199
- params: {
200
- organization: '{YOUR_ORGANIZATION_ID}',
201
- invitation: '{INVITE_CODE}'
202
- }
203
- %>
120
+ Rails.application.routes.draw do
121
+ # ..
122
+ get '/auth/auth0/callback' => 'auth0#callback'
123
+ get '/auth/failure' => 'auth0#failure'
124
+ get '/auth/logout' => 'auth0#logout'
125
+ end
204
126
  ```
205
127
 
206
- ## Contribution
207
-
208
- We appreciate feedback and contribution to this repo! Before you get started, please see the following:
209
-
210
- - [Auth0's contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
211
- - [Auth0's Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
212
- - [This repo's contribution guide](CONTRIBUTING.md)
128
+ ## Logging in
213
129
 
214
- ## Support + Feedback
130
+ To redirect your users to Auth0 for authentication, redirect your users to the `/auth/auth0` endpoint of your app. One way to do this is to use a link or button on a page:
215
131
 
216
- - Use [Community](https://community.auth0.com/) for usage, questions, specific cases.
217
- - Use [Issues](https://github.com/auth0/omniauth-auth0/issues) here for code-level support and bug reports.
218
- - Paid customers can use [Support](https://support.auth0.com/) to submit a trouble ticket for production-affecting issues.
132
+ ```html
133
+ <%= button_to 'Login', '/auth/auth0', method: :post %>
134
+ ```
219
135
 
220
- ## Vulnerability Reporting
136
+ ## Feedback
221
137
 
222
- Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
138
+ ### Contributing
223
139
 
224
- ## What is Auth0?
140
+ We appreciate feedback and contribution to this repo! Before you get started, please see the following:
225
141
 
226
- Auth0 helps you to easily:
142
+ - [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
143
+ - [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
144
+ - [This repo's contribution guide](https://github.com/auth0/omniauth-auth0/blob/master/CONTRIBUTING.md)
227
145
 
228
- - implement authentication with multiple identity providers, including social (e.g., Google, Facebook, Microsoft, LinkedIn, GitHub, Twitter, etc), or enterprise (e.g., Windows Azure AD, Google Apps, Active Directory, ADFS, SAML, etc.)
229
- - log in users with username/password databases, passwordless, or multi-factor authentication
230
- - link multiple user accounts together
231
- - generate signed JSON Web Tokens to authorize your API calls and flow the user identity securely
232
- - access demographics and analytics detailing how, when, and where users are logging in
233
- - enrich user profiles from other data sources using customizable JavaScript rules
146
+ ### Raise an issue
234
147
 
235
- [Why Auth0?](https://auth0.com/why-auth0)
148
+ To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/omniauth-auth0/issues).
236
149
 
237
- ## License
150
+ ### Vulnerability Reporting
238
151
 
239
- The OmniAuth Auth0 strategy is licensed under MIT - [LICENSE](LICENSE)
152
+ Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
240
153
 
154
+ ---
241
155
 
242
- [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fauth0%2Fomniauth-auth0.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fomniauth-auth0?ref=badge_large)
156
+ <p align="center">
157
+ <picture>
158
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150">
159
+ <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
160
+ <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
161
+ </picture>
162
+ </p>
163
+ <p align="center">
164
+ Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a>
165
+ </p>
166
+ <p align="center">
167
+ This project is licensed under the MIT license. See the <a href="https://github.com/auth0/omniauth-auth0/blob/master/LICENSE"> LICENSE</a> file for more info.
168
+ </p>
@@ -84,7 +84,7 @@ module OmniAuth
84
84
  # Define the parameters used for the /authorize endpoint
85
85
  def authorize_params
86
86
  params = super
87
- %w[connection connection_scope prompt screen_hint login_hint organization invitation].each do |key|
87
+ %w[connection connection_scope prompt screen_hint login_hint organization invitation ui_locales].each do |key|
88
88
  params[key] = request.params[key] if request.params.key?(key)
89
89
  end
90
90
 
@@ -94,7 +94,7 @@ module OmniAuth
94
94
  params[:leeway] = 60 unless params[:leeway]
95
95
 
96
96
  # Store authorize params in the session for token verification
97
- session['authorize_params'] = params
97
+ session['authorize_params'] = params.to_hash
98
98
 
99
99
  params
100
100
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Auth0
3
- VERSION = '2.6.0'.freeze
3
+ VERSION = '3.1.0'.freeze
4
4
  end
5
5
  end
@@ -21,10 +21,10 @@ omniauth-auth0 is the OmniAuth strategy for Auth0.
21
21
  s.executables = `git ls-files -- bin/*`.split('\n').map{ |f| File.basename(f) }
22
22
  s.require_paths = ['lib']
23
23
 
24
- s.add_runtime_dependency 'omniauth', '~> 1.9'
25
- s.add_runtime_dependency 'omniauth-oauth2', '~> 1.5'
24
+ s.add_runtime_dependency 'omniauth', '~> 2'
25
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1'
26
26
 
27
27
  s.add_development_dependency 'bundler'
28
-
28
+
29
29
  s.license = 'MIT'
30
30
  end
data/opslevel.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ version: 1
3
+ repository:
4
+ owner: dx_sdks
5
+ tier:
6
+ tags:
@@ -357,7 +357,7 @@ describe OmniAuth::Auth0::JWTValidator do
357
357
  message: "Nonce (nonce) claim value mismatch in the ID token; expected (noncey), found (mismatch)"
358
358
  }))
359
359
  end
360
-
360
+
361
361
  it 'should fail when “aud” is an array of strings and azp claim is not present' do
362
362
  aud = [
363
363
  client_id,
@@ -476,7 +476,7 @@ describe OmniAuth::Auth0::JWTValidator do
476
476
  expect(id_token['auth_time']).to eq(auth_time)
477
477
  end
478
478
 
479
- it 'should fail when authorize params has organization but org_id is missing in the token', focus: true do
479
+ it 'should fail when authorize params has organization but org_id is missing in the token' do
480
480
  payload = {
481
481
  iss: "https://#{domain}/",
482
482
  sub: 'sub',
@@ -493,7 +493,7 @@ describe OmniAuth::Auth0::JWTValidator do
493
493
  }))
494
494
  end
495
495
 
496
- it 'should fail when authorize params has organization but token org_id does not match', focus: true do
496
+ it 'should fail when authorize params has organization but token org_id does not match' do
497
497
  payload = {
498
498
  iss: "https://#{domain}/",
499
499
  sub: 'sub',
@@ -544,7 +544,7 @@ describe OmniAuth::Auth0::JWTValidator do
544
544
  expect do
545
545
  verified_token = make_jwt_validator(opt_domain: domain).verify(token)
546
546
  end.to raise_error(an_instance_of(JWT::VerificationError).and having_attributes({
547
- message: "Signature verification raised"
547
+ message: "Signature verification failed"
548
548
  }))
549
549
  end
550
550
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
  require 'jwt'
5
+ require 'multi_json'
6
+
7
+ OmniAuth.config.allowed_request_methods = [:get, :post]
5
8
 
6
9
  RSpec.shared_examples 'site has valid domain url' do |url|
7
10
  it { expect(subject.site).to eq(url) }
@@ -196,6 +199,19 @@ describe OmniAuth::Strategies::Auth0 do
196
199
  expect(redirect_url).not_to have_query('invitation')
197
200
  end
198
201
 
202
+ def session
203
+ session_cookie = last_response.cookies['rack.session'].first
204
+ session_data, _, _ = session_cookie.rpartition('--')
205
+ decoded_session_data = Base64.decode64(session_data)
206
+ Marshal.load(decoded_session_data)
207
+ end
208
+
209
+ it "stores session['authorize_params'] as a plain Ruby Hash" do
210
+ get '/auth/auth0'
211
+
212
+ expect(session['authorize_params'].class).to eq(::Hash)
213
+ end
214
+
199
215
  describe 'callback' do
200
216
  let(:access_token) { 'access token' }
201
217
  let(:expires_in) { 2000 }
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  $LOAD_PATH.unshift File.expand_path(__dir__)
2
2
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
3
3
 
4
+ require 'multi_json'
4
5
  require 'simplecov'
5
6
  SimpleCov.start
6
7
 
7
8
  if ENV['CI'] == 'true'
8
- require 'codecov'
9
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
9
+ require 'simplecov-cobertura'
10
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
10
11
  end
11
12
 
12
13
  require 'rspec'
@@ -22,6 +23,8 @@ RSpec.configure do |config|
22
23
  config.include WebMock::API
23
24
  config.include Rack::Test::Methods
24
25
  config.extend OmniAuth::Test::StrategyMacros, type: :strategy
26
+ config.filter_run focus: true
27
+ config.run_all_when_everything_filtered = true
25
28
 
26
29
  def app
27
30
  @app || make_application
@@ -39,7 +42,7 @@ RSpec.configure do |config|
39
42
  configure do
40
43
  enable :sessions
41
44
  set :show_exceptions, false
42
- set :session_secret, 'TEST'
45
+ set :session_secret, '9771aff2c634257053c62ba072c54754bd2cc92739b37e81c3eda505da48c2ec'
43
46
  end
44
47
 
45
48
  use OmniAuth::Builder do