auth0 4.10.0 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +2 -0
- data/CHANGELOG.md +8 -0
- data/DEPLOYMENT.md +14 -0
- data/Gemfile.lock +18 -18
- data/README.md +60 -25
- data/lib/auth0/api/authentication_endpoints.rb +4 -2
- data/lib/auth0/version.rb +1 -1
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5510689e9c12f2e8b6cdaa0b7a36487b426e65d550a71b8e507d1c1a6328032b
|
4
|
+
data.tar.gz: 23a2e96a3dadbe065252666ec16cee463d4511ec464be83abcc05ba43f1025a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f018c7269551d67247bd49841a76e379efdfad2b650efa5506bb8aa75d28576fdf66e7bd2d1f405fc1d92471d53f5ade81b86101a91ffb29053d9313f8ab9591
|
7
|
+
data.tar.gz: 19a41e79a0b6bd393eb8b85c882dcff8ff7ccefa71c33896928cf53cb5068b495e3d42aa0751ad6fc4d2b103b76049f0570147accfa7b406ff329e53100d009d
|
data/.env.example
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v4.11.0](https://github.com/auth0/ruby-auth0/tree/v4.11.0) (2020-05-06)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.10.0...v4.11.0)
|
6
|
+
|
7
|
+
**Added**
|
8
|
+
|
9
|
+
- [SDK-1542] Add client secret to Passwordless flow since it is now required [\#217](https://github.com/auth0/ruby-auth0/pull/217) ([stevehobbsdev](https://github.com/stevehobbsdev))
|
10
|
+
|
3
11
|
## [v4.10.0](https://github.com/auth0/ruby-auth0/tree/v4.10.0) (2020-04-23)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.9.0...v4.10.0)
|
data/DEPLOYMENT.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# Releasing the gem
|
2
|
+
|
3
|
+
## Credentials set up
|
4
|
+
|
5
|
+
Make sure you have access in https://rubygems.org/gems/auth0/ and that your Ruby Gems tokens are set in `~/.gem/credentials`.
|
6
|
+
|
7
|
+
In order to generate the required changelog entry, define an environment variable `GITHUB_READ_TOKEN` with a Github API token that has READ access to `repo:public_repo`. You can generate a Github API Token [here](https://github.com/settings/tokens/new?description=GitHub%20Changelog%20Generator%20token).
|
8
|
+
|
9
|
+
Create a new Github Milestone with the version name prefixed with `v`. i.e. `v4.10.2`. Assign every Issue and Pull Request to be included on this release to that Milestone, and tag them with the `CH:xxxxxx` labels, depending on the type of change fixed or introduced there.
|
10
|
+
|
11
|
+
Finally, follow the next steps:
|
12
|
+
|
1
13
|
```bash
|
2
14
|
# Install gems for exec commands
|
3
15
|
bundle install
|
@@ -45,3 +57,5 @@ git push origin vX.X.X
|
|
45
57
|
# Rubygems token can be updated in ~/.gem/credentials
|
46
58
|
bundle exec gem release
|
47
59
|
```
|
60
|
+
|
61
|
+
The steps above were tested with Ruby `v2.5.7`.
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
auth0 (4.
|
4
|
+
auth0 (4.11.0)
|
5
5
|
rest-client (~> 2.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (6.0.
|
11
|
-
actionview (= 6.0.
|
12
|
-
activesupport (= 6.0.
|
10
|
+
actionpack (6.0.3)
|
11
|
+
actionview (= 6.0.3)
|
12
|
+
activesupport (= 6.0.3)
|
13
13
|
rack (~> 2.0, >= 2.0.8)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
actionview (6.0.
|
18
|
-
activesupport (= 6.0.
|
17
|
+
actionview (6.0.3)
|
18
|
+
activesupport (= 6.0.3)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
activesupport (6.0.
|
23
|
+
activesupport (6.0.3)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 0.7, < 2)
|
26
26
|
minitest (~> 5.1)
|
27
27
|
tzinfo (~> 1.1)
|
28
|
-
zeitwerk (~> 2.2)
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
29
|
addressable (2.7.0)
|
30
30
|
public_suffix (>= 2.0.2, < 5.0)
|
31
31
|
ast (2.4.0)
|
@@ -93,7 +93,7 @@ GEM
|
|
93
93
|
method_source (0.8.2)
|
94
94
|
mime-types (3.3.1)
|
95
95
|
mime-types-data (~> 3.2015)
|
96
|
-
mime-types-data (3.
|
96
|
+
mime-types-data (3.2020.0425)
|
97
97
|
mini_portile2 (2.4.0)
|
98
98
|
minitest (5.14.0)
|
99
99
|
multi_json (1.14.1)
|
@@ -105,7 +105,7 @@ GEM
|
|
105
105
|
nenv (~> 0.1)
|
106
106
|
shellany (~> 0.0)
|
107
107
|
parallel (1.19.1)
|
108
|
-
parser (2.7.1.
|
108
|
+
parser (2.7.1.2)
|
109
109
|
ast (~> 2.4.0)
|
110
110
|
pry (0.10.4)
|
111
111
|
coderay (~> 1.1.0)
|
@@ -122,15 +122,15 @@ GEM
|
|
122
122
|
nokogiri (>= 1.6)
|
123
123
|
rails-html-sanitizer (1.3.0)
|
124
124
|
loofah (~> 2.3)
|
125
|
-
railties (6.0.
|
126
|
-
actionpack (= 6.0.
|
127
|
-
activesupport (= 6.0.
|
125
|
+
railties (6.0.3)
|
126
|
+
actionpack (= 6.0.3)
|
127
|
+
activesupport (= 6.0.3)
|
128
128
|
method_source
|
129
129
|
rake (>= 0.8.7)
|
130
130
|
thor (>= 0.20.3, < 2.0)
|
131
131
|
rainbow (3.0.0)
|
132
132
|
rake (13.0.1)
|
133
|
-
rb-fsevent (0.10.
|
133
|
+
rb-fsevent (0.10.4)
|
134
134
|
rb-inotify (0.10.1)
|
135
135
|
ffi (~> 1.0)
|
136
136
|
rest-client (2.0.2)
|
@@ -142,15 +142,15 @@ GEM
|
|
142
142
|
rspec-core (~> 3.9.0)
|
143
143
|
rspec-expectations (~> 3.9.0)
|
144
144
|
rspec-mocks (~> 3.9.0)
|
145
|
-
rspec-core (3.9.
|
146
|
-
rspec-support (~> 3.9.
|
145
|
+
rspec-core (3.9.2)
|
146
|
+
rspec-support (~> 3.9.3)
|
147
147
|
rspec-expectations (3.9.1)
|
148
148
|
diff-lcs (>= 1.2.0, < 2.0)
|
149
149
|
rspec-support (~> 3.9.0)
|
150
150
|
rspec-mocks (3.9.1)
|
151
151
|
diff-lcs (>= 1.2.0, < 2.0)
|
152
152
|
rspec-support (~> 3.9.0)
|
153
|
-
rspec-support (3.9.
|
153
|
+
rspec-support (3.9.3)
|
154
154
|
rubocop (0.82.0)
|
155
155
|
jaro_winkler (~> 1.5.1)
|
156
156
|
parallel (~> 1.10)
|
@@ -191,7 +191,7 @@ GEM
|
|
191
191
|
addressable (>= 2.3.6)
|
192
192
|
crack (>= 0.3.2)
|
193
193
|
hashdiff (>= 0.4.0, < 2.0.0)
|
194
|
-
yard (0.9.
|
194
|
+
yard (0.9.25)
|
195
195
|
zeitwerk (2.3.0)
|
196
196
|
|
197
197
|
PLATFORMS
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Ruby API client for the [Auth0](https://auth0.com) platform.
|
|
12
12
|
|
13
13
|
This gem can be installed directly:
|
14
14
|
|
15
|
-
```
|
15
|
+
```bash
|
16
16
|
$ gem install auth0
|
17
17
|
```
|
18
18
|
|
@@ -26,7 +26,7 @@ bundle add auth0
|
|
26
26
|
|
27
27
|
You can build the API documentation with the following:
|
28
28
|
|
29
|
-
```
|
29
|
+
```bash
|
30
30
|
bundle exec rake documentation
|
31
31
|
```
|
32
32
|
|
@@ -65,22 +65,22 @@ class AllUsersController < ApplicationController
|
|
65
65
|
}
|
66
66
|
@users = auth0_client.users @params
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
private
|
70
|
-
|
70
|
+
|
71
71
|
# Setup the Auth0 API connection.
|
72
72
|
def auth0_client
|
73
73
|
@auth0_client ||= Auth0Client.new(
|
74
74
|
client_id: ENV['AUTH0_RUBY_CLIENT_ID'],
|
75
75
|
client_secret: ENV['AUTH0_RUBY_CLIENT_SECRET'],
|
76
|
-
# If you pass in a client_secret value, the SDK will automatically try to get a
|
77
|
-
# Management API token for this application. Make sure your Application can make a
|
76
|
+
# If you pass in a client_secret value, the SDK will automatically try to get a
|
77
|
+
# Management API token for this application. Make sure your Application can make a
|
78
78
|
# Client Credentials grant (Application settings in Auth0 > Advanced > Grant Types
|
79
79
|
# tab) and that the Application is authorized for the Management API:
|
80
80
|
# https://auth0.com/docs/api-auth/config/using-the-auth0-dashboard
|
81
81
|
#
|
82
82
|
# Otherwise, you can pass in a Management API token directly for testing or temporary
|
83
|
-
# access using the key below.
|
83
|
+
# access using the key below.
|
84
84
|
# token: ENV['AUTH0_RUBY_API_TOKEN'],
|
85
85
|
domain: ENV['AUTH0_RUBY_DOMAIN'],
|
86
86
|
api_version: 2,
|
@@ -107,36 +107,71 @@ This should show the parameters passed to the `users` method and a list of users
|
|
107
107
|
|
108
108
|
In addition to the Management API, this SDK also provides access to [Authentication API](https://auth0.com/docs/api/authentication) endpoints with the `Auth0::API::AuthenticationEndpoints` module. For basic login capability, we suggest using our OmniAuth stategy [detailed here](https://auth0.com/docs/quickstart/webapp/rails/01-login). Other authentication tasks currently supported are:
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
- Register a new user with a database connection using the `signup` method.
|
111
|
+
- Redirect a user to the universal login page for authentication using the `authorization_url` method.
|
112
|
+
- Log a user into a highly trusted app with the [Resource Owner Password grant](https://auth0.com/docs/api-auth/tutorials/password-grant) using the `login` method.
|
113
|
+
- Exchange an authorization code for an access token on callback using the `obtain_user_tokens` method (see the note on state validation below).
|
114
|
+
- Send a change password email to a database connection user using the `change_password` method.
|
115
|
+
- Log a user out of Auth0 with the `logout_url` method.
|
116
116
|
|
117
|
-
**Important note on state validation**: If you choose to implement a login flow callback yourself, it is important to generate and store a `state` value, pass that value to Auth0 in the `authorization_url` method, and validate it in your callback URL before calling `obtain_user_tokens`. For more information on state validation, [please see our documentation](https://auth0.com/docs/protocols/oauth2/oauth-state).
|
117
|
+
**Important note on state validation**: If you choose to implement a login flow callback yourself, it is important to generate and store a `state` value, pass that value to Auth0 in the `authorization_url` method, and validate it in your callback URL before calling `obtain_user_tokens`. For more information on state validation, [please see our documentation](https://auth0.com/docs/protocols/oauth2/oauth-state).
|
118
118
|
|
119
119
|
Please note that this module implements endpoints that might be deprecated for newer tenants. If you have any questions about how and when the endpoints should be used, consult the [documentation](https://auth0.com/docs/api/authentication) or ask in our [Community forums](https://community.auth0.com/tags/wordpress).
|
120
120
|
|
121
|
+
## Development
|
122
|
+
|
123
|
+
In order to set up the local environment you'd have to have Ruby installed and a few global gems used to run and record the unit tests. A working Ruby version can be taken from the [CI script](/.circleci/config.yml). At the moment of this writting we're using Ruby `2.5.7`.
|
124
|
+
|
125
|
+
> It is expected that every Pull Request introducing a fix, change or feature contains enough test coverage to assert the new behavior.
|
126
|
+
|
127
|
+
### Running the tests
|
128
|
+
|
129
|
+
Install the gems required for this project.
|
130
|
+
|
131
|
+
```bash
|
132
|
+
bundle install
|
133
|
+
```
|
134
|
+
|
135
|
+
Finally, run the tests.
|
136
|
+
|
137
|
+
```bash
|
138
|
+
bundle exec rake test
|
139
|
+
```
|
140
|
+
|
141
|
+
#### Running only unit tests
|
142
|
+
|
143
|
+
You can run only the unit tests and ignore the integration tests by running the following:
|
144
|
+
|
145
|
+
```bash
|
146
|
+
bundle exec rake spec
|
147
|
+
```
|
148
|
+
|
149
|
+
#### Running only integration tests
|
150
|
+
|
151
|
+
You can run only the unit tests and ignore the integration tests by running the following:
|
152
|
+
|
153
|
+
```bash
|
154
|
+
bundle exec rake integration
|
155
|
+
```
|
121
156
|
|
122
157
|
## More Information
|
123
158
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
159
|
+
- [Login using OmniAuth](https://auth0.com/docs/quickstart/webapp/rails/01-login)
|
160
|
+
- [API authentication in Ruby](https://auth0.com/docs/quickstart/backend/ruby)
|
161
|
+
- [API authentication in Rails](https://auth0.com/docs/quickstart/backend/rails)
|
162
|
+
- [Managing authentication with Auth0 (blog)](https://auth0.com/blog/rails-5-with-auth0/)
|
163
|
+
- [Ruby on Rails workflow with Docker (blog)](https://auth0.com/blog/ruby-on-rails-killer-workflow-with-docker-part-1/)
|
129
164
|
|
130
165
|
## What is Auth0?
|
131
166
|
|
132
167
|
Auth0 helps you to:
|
133
168
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
169
|
+
- Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce** among others, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.
|
170
|
+
- Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**.
|
171
|
+
- Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user.
|
172
|
+
- Support for generating signed [JSON Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely.
|
173
|
+
- Analytics of how, when, and where users are logging in.
|
174
|
+
- Pull data from other sources and add it to the user profile with [JavaScript rules](https://docs.auth0.com/rules).
|
140
175
|
|
141
176
|
## Create a free Auth0 Account
|
142
177
|
|
@@ -170,7 +170,8 @@ module Auth0
|
|
170
170
|
send: send,
|
171
171
|
authParams: auth_params,
|
172
172
|
connection: 'email',
|
173
|
-
client_id: @client_id
|
173
|
+
client_id: @client_id,
|
174
|
+
client_secret: @client_secret
|
174
175
|
}
|
175
176
|
post('/passwordless/start', request_params)
|
176
177
|
end
|
@@ -185,7 +186,8 @@ module Auth0
|
|
185
186
|
request_params = {
|
186
187
|
phone_number: phone_number,
|
187
188
|
connection: 'sms',
|
188
|
-
client_id: @client_id
|
189
|
+
client_id: @client_id,
|
190
|
+
client_secret: @client_secret
|
189
191
|
}
|
190
192
|
post('/passwordless/start', request_params)
|
191
193
|
end
|
data/lib/auth0/version.rb
CHANGED
@@ -355,6 +355,7 @@ describe Auth0::Api::AuthenticationEndpoints do
|
|
355
355
|
expect(@instance).to receive(:post).with(
|
356
356
|
'/passwordless/start',
|
357
357
|
client_id: @instance.client_id,
|
358
|
+
client_secret: @instance.client_secret,
|
358
359
|
connection: 'email',
|
359
360
|
email: 'test@test.com',
|
360
361
|
send: 'code',
|
@@ -388,6 +389,7 @@ describe Auth0::Api::AuthenticationEndpoints do
|
|
388
389
|
expect(@instance).to receive(:post).with(
|
389
390
|
'/passwordless/start',
|
390
391
|
client_id: @instance.client_id,
|
392
|
+
client_secret: @instance.client_secret,
|
391
393
|
connection: 'sms',
|
392
394
|
phone_number: phone_number
|
393
395
|
)
|
data/spec/spec_helper.rb
CHANGED
@@ -27,6 +27,9 @@ VCR.configure do |config|
|
|
27
27
|
config.hook_into :webmock
|
28
28
|
config.filter_sensitive_data('CLIENT_SECRET') { ENV['CLIENT_SECRET'] }
|
29
29
|
config.filter_sensitive_data('API_TOKEN') { ENV['MASTER_JWT'] }
|
30
|
+
|
31
|
+
ENV['DOMAIN'] = 'auth0-sdk-tests.auth0.com'
|
32
|
+
ENV['CLIENT_ID'] = '2cnWuug6zaFX1j0ge1P99jAUn0F4XSuI'
|
30
33
|
end
|
31
34
|
|
32
35
|
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Auth0
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
@@ -224,6 +224,7 @@ extra_rdoc_files: []
|
|
224
224
|
files:
|
225
225
|
- ".bundle/config"
|
226
226
|
- ".circleci/config.yml"
|
227
|
+
- ".env.example"
|
227
228
|
- ".gemrelease"
|
228
229
|
- ".github/CODEOWNERS"
|
229
230
|
- ".github/ISSUE_TEMPLATE.md"
|