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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +22 -3
- data/.devcontainer/devcontainer.json +18 -0
- data/.github/workflows/semgrep.yml +24 -0
- data/.gitignore +0 -2
- data/.semgrepignore +4 -0
- data/.shiprc +7 -0
- data/CHANGELOG.md +91 -10
- data/EXAMPLES.md +167 -0
- data/Gemfile +15 -15
- data/Gemfile.lock +180 -0
- data/README.md +97 -171
- data/lib/omniauth/strategies/auth0.rb +2 -2
- data/lib/omniauth-auth0/version.rb +1 -1
- data/omniauth-auth0.gemspec +3 -3
- data/opslevel.yml +6 -0
- data/spec/omniauth/auth0/jwt_validator_spec.rb +4 -4
- data/spec/omniauth/strategies/auth0_spec.rb +16 -0
- data/spec/spec_helper.rb +6 -3
- metadata +14 -8
- data/CODE_OF_CONDUCT.md +0 -3
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
|
-
|
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
|
-
|
16
|
-
-
|
17
|
-
|
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
|
-
##
|
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
|
-
##
|
43
|
+
## Configure the SDK
|
53
44
|
|
54
|
-
|
45
|
+
Adding the SDK to your Rails app requires a few steps:
|
55
46
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
52
|
+
### Create the configuration file
|
62
53
|
|
63
|
-
|
54
|
+
Create the file `./config/auth0.yml` within your application directory with the following content:
|
64
55
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
:
|
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
|
-
|
83
|
-
|
84
|
-
### Authentication hash
|
85
|
-
|
86
|
-
The Auth0 strategy will provide the standard OmniAuth hash attributes:
|
63
|
+
### Create the initializer
|
87
64
|
|
88
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
:
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
-
###
|
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
|
-
|
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
|
-
|
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
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
-
|
115
|
+
### Add routes
|
188
116
|
|
189
|
-
|
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
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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
|
-
##
|
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
|
-
|
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
|
-
|
217
|
-
|
218
|
-
|
132
|
+
```html
|
133
|
+
<%= button_to 'Login', '/auth/auth0', method: :post %>
|
134
|
+
```
|
219
135
|
|
220
|
-
##
|
136
|
+
## Feedback
|
221
137
|
|
222
|
-
|
138
|
+
### Contributing
|
223
139
|
|
224
|
-
|
140
|
+
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
|
225
141
|
|
226
|
-
Auth0
|
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
|
-
|
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
|
-
[
|
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
|
-
|
150
|
+
### Vulnerability Reporting
|
238
151
|
|
239
|
-
|
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
|
-
|
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
|
data/omniauth-auth0.gemspec
CHANGED
@@ -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', '~>
|
25
|
-
s.add_runtime_dependency 'omniauth-oauth2', '~> 1
|
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
@@ -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'
|
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'
|
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
|
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 '
|
9
|
-
SimpleCov.formatter = SimpleCov::Formatter::
|
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, '
|
45
|
+
set :session_secret, '9771aff2c634257053c62ba072c54754bd2cc92739b37e81c3eda505da48c2ec'
|
43
46
|
end
|
44
47
|
|
45
48
|
use OmniAuth::Builder do
|