auth0 4.15.0 → 5.0.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 +26 -3
- data/.github/CODEOWNERS +1 -1
- data/.github/ISSUE_TEMPLATE/config.yml +8 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +39 -0
- data/.github/ISSUE_TEMPLATE/report_a_bug.md +55 -0
- data/.gitignore +1 -1
- data/.yardoc/checksums +22 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CHANGELOG.md +83 -0
- data/Gemfile +0 -1
- data/README.md +5 -7
- data/Rakefile +0 -22
- data/auth0.gemspec +4 -3
- data/examples/ruby-api/.gitignore +0 -6
- data/lib/auth0/api/authentication_endpoints.rb +6 -220
- data/lib/auth0/api/v2/jobs.rb +11 -1
- data/lib/auth0/api/v2/tickets.rb +12 -1
- data/lib/auth0/api/v2/users.rb +21 -8
- data/lib/auth0/exception.rb +2 -7
- data/lib/auth0/mixins.rb +0 -1
- data/lib/auth0/mixins/access_token_struct.rb +2 -2
- data/lib/auth0/mixins/api_token_struct.rb +2 -2
- data/lib/auth0/mixins/httpproxy.rb +3 -1
- data/lib/auth0/mixins/initializer.rb +1 -7
- data/lib/auth0/mixins/permission_struct.rb +2 -2
- data/lib/auth0/mixins/validation.rb +1 -1
- data/lib/auth0/version.rb +1 -1
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +13 -1
- data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +7 -1
- data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +1 -1
- data/spec/lib/auth0/api/v2/jobs_spec.rb +17 -0
- data/spec/lib/auth0/api/v2/roles_spec.rb +4 -4
- data/spec/lib/auth0/api/v2/tickets_spec.rb +17 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +38 -11
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +2 -2
- data/spec/spec_helper.rb +6 -1
- data/spec/support/credentials.rb +0 -19
- metadata +43 -44
- data/.github/ISSUE_TEMPLATE.md +0 -39
- data/Gemfile.lock +0 -229
- data/deploy_documentation.sh +0 -29
- data/doc_config/templates/default/fulldoc/html/css/full_list.css +0 -79
- data/doc_config/templates/default/fulldoc/html/css/style.css +0 -546
- data/doc_config/templates/default/layout/html/breadcrumb.erb +0 -11
- data/doc_config/templates/default/layout/html/footer.erb +0 -115
- data/doc_config/templates/default/layout/html/headers.erb +0 -17
- data/doc_config/templates/default/layout/html/layout.erb +0 -27
- data/lib/auth0/api/v1.rb +0 -19
- data/lib/auth0/api/v1/clients.rb +0 -58
- data/lib/auth0/api/v1/connections.rb +0 -68
- data/lib/auth0/api/v1/logs.rb +0 -43
- data/lib/auth0/api/v1/rules.rb +0 -57
- data/lib/auth0/api/v1/users.rb +0 -227
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -703
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf18eaf917c7c8c5e3cccc4dad6a9824e50c921ea6b21612dc175ceb9dc447bc
|
4
|
+
data.tar.gz: 410e68beb033e30432bef49be72a04a14d65ecc63f5fd3dab784ca0bbf222f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8c767fc4a1539b9d778893bfd1eda7ccbd5ca1194dba5f79f5d84a5563c6038fdf66d640a0be6150cc913e0ce7479f9b434fe6552eec5459e058b0e3cbab8e
|
7
|
+
data.tar.gz: f8f03fd5d1e0d5358874fee49e72024942825e38a74799cc732af2977fcc5a582eac211dfbe021e22d8d55992460fbfbf4e48b66511180bb12c4c1ede415cf4b
|
data/.circleci/config.yml
CHANGED
@@ -1,8 +1,30 @@
|
|
1
1
|
version: 2.1
|
2
|
+
|
3
|
+
matrix_ruby_versions: &matrix_ruby_versions
|
4
|
+
matrix:
|
5
|
+
parameters:
|
6
|
+
ruby_version: ["2.5", "2.6", "2.7", "3.0"]
|
7
|
+
# Default version of ruby to use for lint and publishing
|
8
|
+
default_ruby_version: &default_ruby_version "2.7"
|
9
|
+
|
10
|
+
executors:
|
11
|
+
ruby-image:
|
12
|
+
parameters:
|
13
|
+
ruby_version:
|
14
|
+
type: string
|
15
|
+
default: *default_ruby_version
|
16
|
+
docker:
|
17
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
18
|
+
|
2
19
|
jobs:
|
3
20
|
run-tests:
|
4
|
-
|
5
|
-
|
21
|
+
parameters:
|
22
|
+
ruby_version:
|
23
|
+
type: string
|
24
|
+
default: *default_ruby_version
|
25
|
+
executor:
|
26
|
+
name: ruby-image
|
27
|
+
ruby_version: << parameters.ruby_version >>
|
6
28
|
steps:
|
7
29
|
- checkout
|
8
30
|
- restore_cache:
|
@@ -20,4 +42,5 @@ jobs:
|
|
20
42
|
workflows:
|
21
43
|
tests:
|
22
44
|
jobs:
|
23
|
-
- run-tests
|
45
|
+
- run-tests:
|
46
|
+
<<: *matrix_ruby_versions
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @auth0/dx-sdks-
|
1
|
+
* @auth0/dx-sdks-engineer
|
@@ -0,0 +1,8 @@
|
|
1
|
+
blank_issues_enabled: false
|
2
|
+
contact_links:
|
3
|
+
- name: Auth0 Community
|
4
|
+
url: https://community.auth0.com/c/sdks/5
|
5
|
+
about: Discuss this SDK in the Auth0 Community forums
|
6
|
+
- name: SDK API Documentation
|
7
|
+
url: https://www.rubydoc.info/gems/auth0
|
8
|
+
about: Read the API documentation for this SDK
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea or a feature for this project
|
4
|
+
title: ''
|
5
|
+
labels: feature request
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
<!--
|
10
|
+
**Please do not report security vulnerabilities here**. The Responsible Disclosure Program (https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
11
|
+
|
12
|
+
Thank you in advance for helping us to improve this library! Your attention to detail here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community (https://community.auth0.com/) or Auth0 Support (https://support.auth0.com/). Finally, to avoid duplicates, please search existing Issues before submitting one here.
|
13
|
+
|
14
|
+
By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct (https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
|
15
|
+
-->
|
16
|
+
|
17
|
+
### Describe the problem you'd like to have solved
|
18
|
+
|
19
|
+
<!--
|
20
|
+
> A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
21
|
+
-->
|
22
|
+
|
23
|
+
### Describe the ideal solution
|
24
|
+
|
25
|
+
<!--
|
26
|
+
> A clear and concise description of what you want to happen.
|
27
|
+
-->
|
28
|
+
|
29
|
+
## Alternatives and current work-arounds
|
30
|
+
|
31
|
+
<!--
|
32
|
+
> A clear and concise description of any alternatives you've considered or any work-arounds that are currently in place.
|
33
|
+
-->
|
34
|
+
|
35
|
+
### Additional information, if any
|
36
|
+
|
37
|
+
<!--
|
38
|
+
> Add any other context or screenshots about the feature request here.
|
39
|
+
-->
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
name: Report a bug
|
3
|
+
about: Have you found a bug or issue? Create a bug report for this SDK
|
4
|
+
title: ''
|
5
|
+
labels: bug report
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
<!--
|
10
|
+
**Please do not report security vulnerabilities here**. The Responsible Disclosure Program (https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
11
|
+
|
12
|
+
Thank you in advance for helping us to improve this library! Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community (https://community.auth0.com/) or Auth0 Support (https://support.auth0.com/). Finally, to avoid duplicates, please search existing Issues before submitting one here.
|
13
|
+
|
14
|
+
By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct (https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
|
15
|
+
-->
|
16
|
+
|
17
|
+
### Describe the problem
|
18
|
+
|
19
|
+
<!--
|
20
|
+
> Provide a clear and concise description of the issue
|
21
|
+
-->
|
22
|
+
|
23
|
+
### What was the expected behavior?
|
24
|
+
|
25
|
+
<!--
|
26
|
+
> Tell us about the behavior you expected to see
|
27
|
+
-->
|
28
|
+
|
29
|
+
### Reproduction
|
30
|
+
<!--
|
31
|
+
> Detail the steps taken to reproduce this error, and whether this issue can be reproduced consistently or if it is intermittent.
|
32
|
+
> **Note**: If clear, reproducable steps or the smallest sample app demonstrating misbehavior cannot be provided, we may not be able to follow up on this bug report.
|
33
|
+
|
34
|
+
> Where possible, please include:
|
35
|
+
>
|
36
|
+
> - The smallest possible sample app that reproduces the undesirable behavior
|
37
|
+
> - Log files (redact/remove sensitive information)
|
38
|
+
> - Application settings (redact/remove sensitive information)
|
39
|
+
> - Screenshots
|
40
|
+
-->
|
41
|
+
|
42
|
+
- Step 1..
|
43
|
+
- Step 2..
|
44
|
+
- ...
|
45
|
+
|
46
|
+
### Environment
|
47
|
+
|
48
|
+
<!--
|
49
|
+
> Please provide the following:
|
50
|
+
-->
|
51
|
+
|
52
|
+
- **Version of this library used:**
|
53
|
+
- **Which framework are you using, if applicable:**
|
54
|
+
- **Other modules/plugins/libraries that might be involved:**
|
55
|
+
- **Any other relevant information you think would be useful:**
|
data/.gitignore
CHANGED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
lib/auth0/api/v2/jobs.rb 53fe5a814c9da1bb89d7cb885fe7f1151d6ca44a
|
2
|
+
lib/auth0/api/v2/logs.rb f4b9b93248d85d29d58ac12b6b5ebabd72f98adb
|
3
|
+
lib/auth0/api/v2/roles.rb 99e9d0222f0d59f21cb061d13b434bf1a903660a
|
4
|
+
lib/auth0/api/v2/rules.rb 2fbbf4258ba7e6fe67d1ab197ca3503d4e5daf84
|
5
|
+
lib/auth0/api/v2/stats.rb 035b172ad69efb2b040ffcd29319f23017352b4c
|
6
|
+
lib/auth0/api/v2/users.rb 6a648030a6851db60ab13dc3a8a7d46bd51ce977
|
7
|
+
lib/auth0/api/v2/emails.rb 83aaf5ed8082cb2787a0f9c47c463d218a3aee77
|
8
|
+
lib/auth0/api/v2/anomaly.rb c0e38b3cbb4cca65fbe51e6ed69d56cfa5ea8d0e
|
9
|
+
lib/auth0/api/v2/clients.rb 23c2b6f307f6a20537720ad24de30b62de51b9f2
|
10
|
+
lib/auth0/api/v2/prompts.rb 688c71d37885b64ed8c174d54c9403fe21dc0735
|
11
|
+
lib/auth0/api/v2/tenants.rb d20a9c46b6754d504667b6d5187b525274d5ffe8
|
12
|
+
lib/auth0/api/v2/tickets.rb fd192d8b281ca54d318cac0a6b5cff3cad555076
|
13
|
+
lib/auth0/api/v2/guardian.rb 367ea7046c90fdb2065bc66eddb64e47b2d3370d
|
14
|
+
lib/auth0/api/v2/blacklists.rb c3405a13b9c6481a43136b3f4c755602e24a9511
|
15
|
+
lib/auth0/api/v2/connections.rb 3a2ac77a7f9ba97df3fd2e7b958192e06db2e0a7
|
16
|
+
lib/auth0/api/v2/log_streams.rb 1624abe964bd0e9bcfa1107a970f8fa823ec5955
|
17
|
+
lib/auth0/api/v2/user_blocks.rb ce0f80dc00eb32dc1b825c0bbafb89e94d30a28c
|
18
|
+
lib/auth0/api/v2/client_grants.rb ac7489b697d58e7514014e5ae125ffa88015306d
|
19
|
+
lib/auth0/api/v2/users_by_email.rb 95bb92421fb03ec8feee8ef0b5f2ab64c8e51403
|
20
|
+
lib/auth0/api/v2/resource_servers.rb f9c6e7c8fc0bd497e34b0a9e3ac1a81d7fbbe88b
|
21
|
+
lib/auth0/api/v2/device_credentials.rb 94b92db7091ebc7af97fe0fb10a3ad64fa36cdc8
|
22
|
+
lib/auth0/api/authentication_endpoints.rb d6e5c2fabbd79b4f17864b6ec026488d65c5090d
|
data/.yardoc/complete
ADDED
File without changes
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,88 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v5.0.1](https://github.com/auth0/ruby-auth0/tree/v5.0.1) (2021-02-02)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.0.0..v5.0.1)
|
6
|
+
|
7
|
+
**Added**
|
8
|
+
|
9
|
+
- Add test support for Ruby 2.6 and 2.7 and 3.0 [\#256](https://github.com/auth0/ruby-auth0/pull/256) ([fursich](https://github.com/fursich))
|
10
|
+
|
11
|
+
**Fixed**
|
12
|
+
|
13
|
+
- Fixes recovery-code-regeneration URL [\#257](https://github.com/auth0/ruby-auth0/pull/257) ([epintos](https://github.com/apps/epintos))
|
14
|
+
|
15
|
+
**Security**
|
16
|
+
|
17
|
+
- Bumps nokogiri from 1.10.10 to 1.11.1 [\#258](https://github.com/auth0/ruby-auth0/pull/258) ([dependabot](https://github.com/apps/dependabot))
|
18
|
+
|
19
|
+
## [v5.0.0](https://github.com/auth0/ruby-auth0/tree/v5.0.0) (2020-10-22)
|
20
|
+
|
21
|
+
This release addresses some long standing issues with the library that could only be addressed in a major. We have also removed Api/v1 endpoints and other deprecated methods.
|
22
|
+
|
23
|
+
### Migration from v4 to v5
|
24
|
+
|
25
|
+
#### Top Level Structs
|
26
|
+
The following top level structs were colliding with other libraries, this was addressed in [\#183](183) and have been namespaced with `::Auth0::`
|
27
|
+
- `ApiToken` changed to `::Auth0::ApiToken`
|
28
|
+
- `Permission` changed to `::Auth0::Permission`
|
29
|
+
- `AccessToken` changed to `::AccessToken::AccessToken`
|
30
|
+
|
31
|
+
#### Api2 Users create_user method
|
32
|
+
This method was requiring you send in a `name`, which was optional, but didn't require `connection_name` which isn't optional. This was fixed in [\#244](244).
|
33
|
+
|
34
|
+
`Auth0::Api::V2::Users.create_user(name, options = {})` has changed to `Auth0::Api::V2::Users.create_user(connection_name, options = {})`
|
35
|
+
|
36
|
+
#### APIv1 End of Life
|
37
|
+
APIv1 endpoints were deprecated in 4.x and now have been removed in v5. They reached end-of-life in the Public Cloud on 13 July 2020. Migration from v1 to v2 has been documented here https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-management-api-v2
|
38
|
+
|
39
|
+
#### Catching 429 Errors
|
40
|
+
In 4.x `RateLimitEncountered` was inheriting from `Auth0::Unsupported` in order for backwards compatibility. This class is now inheriting `Auth0::HTTPError`. If you are catching 429 errors with `Auth0::Unsupported` then you will need to migrate to catching with `Auth0::HTTPError`.
|
41
|
+
|
42
|
+
### Changes
|
43
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.17.1...v5.0.0)
|
44
|
+
|
45
|
+
**Fixed**
|
46
|
+
- Don't define structs as top-level constants (breaking changes) [\#183](https://github.com/auth0/ruby-auth0/pull/183) ([makimoto](https://github.com/makimoto))
|
47
|
+
- Fix create_user implementation (breaking changes) [\#244](https://github.com/auth0/ruby-auth0/pull/244) ([davidpatrick](https://github.com/davidpatrick))
|
48
|
+
|
49
|
+
**Removed**
|
50
|
+
- Removed Deprecations (breaking changes) [\#245](https://github.com/auth0/ruby-auth0/pull/245) ([davidpatrick](https://github.com/davidpatrick))
|
51
|
+
|
52
|
+
## [v4.17.1](https://github.com/auth0/ruby-auth0/tree/v4.17.1) (2020-10-21)
|
53
|
+
|
54
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.17.0...v4.17.1)
|
55
|
+
|
56
|
+
**Fixed**
|
57
|
+
|
58
|
+
- Addressable dependency [\#247](https://github.com/auth0/ruby-auth0/pull/247) ([davidpatrick](https://github.com/davidpatrick))
|
59
|
+
|
60
|
+
|
61
|
+
## [v4.17.0](https://github.com/auth0/ruby-auth0/tree/v4.17.0) (2020-10-19)
|
62
|
+
|
63
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.16.0...v4.17.0)
|
64
|
+
|
65
|
+
**Added**
|
66
|
+
|
67
|
+
- Add pagination to user permissions [\#241](https://github.com/auth0/ruby-auth0/pull/241) ([davidpatrick](https://github.com/davidpatrick))
|
68
|
+
|
69
|
+
**Deprecated**
|
70
|
+
|
71
|
+
- Addressable URI Escape [\#240](https://github.com/auth0/ruby-auth0/pull/240) ([davidpatrick](https://github.com/apps/davidpatrick))
|
72
|
+
|
73
|
+
|
74
|
+
## [v4.16.0](https://github.com/auth0/ruby-auth0/tree/v4.16.0) (2020-10-02)
|
75
|
+
|
76
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.15.0...v4.16.0)
|
77
|
+
|
78
|
+
**Added**
|
79
|
+
|
80
|
+
- New Email Verification Fields [\#237](https://github.com/auth0/ruby-auth0/pull/237) ([davidpatrick](https://github.com/davidpatrick))
|
81
|
+
|
82
|
+
**Security**
|
83
|
+
|
84
|
+
- Bump actionview from 6.0.3.2 to 6.0.3.3 [\#236](https://github.com/auth0/ruby-auth0/pull/236) ([dependabot[bot]](https://github.com/apps/dependabot))
|
85
|
+
|
3
86
|
## [v4.15.0](https://github.com/auth0/ruby-auth0/tree/v4.15.0) (2020-09-04)
|
4
87
|
|
5
88
|
**Added**
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[](https://codecov.io/gh/auth0/ruby-auth0)
|
6
6
|
[](http://www.rubydoc.info/github/auth0/ruby-auth0/master/frames)
|
7
7
|
[](https://github.com/auth0/ruby-auth0/blob/master/LICENSE)
|
8
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fruby-auth0?ref=badge_shield)
|
8
9
|
|
9
10
|
Ruby API client for the [Auth0](https://auth0.com) platform.
|
10
11
|
|
@@ -24,13 +25,7 @@ bundle add auth0
|
|
24
25
|
|
25
26
|
## API Documentation
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
```bash
|
30
|
-
bundle exec rake documentation
|
31
|
-
```
|
32
|
-
|
33
|
-
To view the generated documentation, open `doc/Auth0/Api.html` .
|
28
|
+
https://www.rubydoc.info/gems/auth0
|
34
29
|
|
35
30
|
## Management API v2
|
36
31
|
|
@@ -234,3 +229,6 @@ If you find a bug or have a feature request, please report them in this reposito
|
|
234
229
|
## License
|
235
230
|
|
236
231
|
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
232
|
+
|
233
|
+
|
234
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fruby-auth0?ref=badge_large)
|
data/Rakefile
CHANGED
@@ -9,28 +9,6 @@ begin
|
|
9
9
|
desc 'Run Rubocop'
|
10
10
|
RuboCop::RakeTask.new(:rubocop)
|
11
11
|
|
12
|
-
require 'yard'
|
13
|
-
DOC_FILES = ['lib/auth0/api/v2/*.rb', 'lib/auth0/api/authentication_endpoints.rb'].freeze
|
14
|
-
|
15
|
-
desc 'Build Documentation'
|
16
|
-
YARD::Rake::YardocTask.new(:documentation) do |t|
|
17
|
-
t.files = DOC_FILES
|
18
|
-
t.options = ['-p', 'doc_config/templates']
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'Publish SDK documentation'
|
22
|
-
task :publish do
|
23
|
-
sh 'rake documentation'
|
24
|
-
sh 'cp -R doc /tmp/ruby-auth0-doc'
|
25
|
-
sh 'git checkout gh-pages'
|
26
|
-
sh 'cp -R /tmp/ruby-auth0-doc/* .'
|
27
|
-
sh 'rm -rf /tmp/ruby-auth0-doc'
|
28
|
-
sh 'git add .'
|
29
|
-
sh 'git commit -am "Rebuild documentation"'
|
30
|
-
sh 'git push origin gh-pages'
|
31
|
-
sh 'git checkout master'
|
32
|
-
end
|
33
|
-
|
34
12
|
desc 'Run Integration Tests'
|
35
13
|
RSpec::Core::RakeTask.new(:integration) do |t|
|
36
14
|
t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}*_spec.rb"]
|
data/auth0.gemspec
CHANGED
@@ -19,19 +19,20 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency 'rest-client', '~> 2.0.0'
|
20
20
|
s.add_runtime_dependency 'jwt', '~> 2.2.0'
|
21
21
|
s.add_runtime_dependency 'zache', '~> 0.12.0'
|
22
|
+
s.add_runtime_dependency 'addressable', '~> 2.7.0'
|
22
23
|
|
24
|
+
s.add_development_dependency 'bundler'
|
23
25
|
s.add_development_dependency 'rake', '~> 13.0'
|
24
26
|
s.add_development_dependency 'fuubar', '~> 2.0'
|
25
27
|
s.add_development_dependency 'guard-rspec', '~> 4.5' unless ENV['CIRCLECI']
|
26
28
|
s.add_development_dependency 'dotenv-rails', '~> 2.0'
|
27
29
|
s.add_development_dependency 'pry', '~> 0.10'
|
28
30
|
s.add_development_dependency 'pry-nav', '~> 0.2.4'
|
29
|
-
s.add_development_dependency 'rspec', '~> 3.
|
31
|
+
s.add_development_dependency 'rspec', '~> 3.5'
|
30
32
|
s.add_development_dependency 'rack-test', '~> 0.6'
|
31
33
|
s.add_development_dependency 'rack', '~> 2.1.2'
|
32
34
|
s.add_development_dependency 'simplecov', '~> 0.9'
|
33
|
-
s.add_development_dependency 'faker', '~>
|
34
|
-
s.add_development_dependency 'yard', '~> 0.9.12'
|
35
|
+
s.add_development_dependency 'faker', '~> 2.0'
|
35
36
|
s.add_development_dependency 'gem-release', '~> 0.7'
|
36
37
|
s.license = 'MIT'
|
37
38
|
end
|
@@ -27,7 +27,7 @@ module Auth0
|
|
27
27
|
audience: audience
|
28
28
|
}
|
29
29
|
response = post('/oauth/token', request_params)
|
30
|
-
ApiToken.new(response['access_token'], response['scope'], response['expires_in'])
|
30
|
+
::Auth0::ApiToken.new(response['access_token'], response['scope'], response['expires_in'])
|
31
31
|
end
|
32
32
|
|
33
33
|
# Get access and ID tokens using an Authorization Code.
|
@@ -37,7 +37,7 @@ module Auth0
|
|
37
37
|
# Required only if it was set at the GET /authorize endpoint
|
38
38
|
# @param client_id [string] Client ID for the Application
|
39
39
|
# @param client_secret [string] Client Secret for the Application.
|
40
|
-
# @return [AccessToken] Returns the access_token and id_token
|
40
|
+
# @return [Auth0::AccessToken] Returns the access_token and id_token
|
41
41
|
def exchange_auth_code_for_tokens(
|
42
42
|
code,
|
43
43
|
redirect_uri: nil,
|
@@ -53,7 +53,7 @@ module Auth0
|
|
53
53
|
code: code,
|
54
54
|
redirect_uri: redirect_uri
|
55
55
|
}
|
56
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
56
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Get access and ID tokens using a refresh token.
|
@@ -64,7 +64,7 @@ module Auth0
|
|
64
64
|
# @param client_secret [string] Client Secret for the Application.
|
65
65
|
# Required when the Application's Token Endpoint Authentication Method
|
66
66
|
# is Post or Basic.
|
67
|
-
# @return [AccessToken] Returns tokens allowed in the refresh_token
|
67
|
+
# @return [Auth0::AccessToken] Returns tokens allowed in the refresh_token
|
68
68
|
def exchange_refresh_token(
|
69
69
|
refresh_token,
|
70
70
|
client_id: @client_id,
|
@@ -78,7 +78,7 @@ module Auth0
|
|
78
78
|
client_secret: client_secret,
|
79
79
|
refresh_token: refresh_token
|
80
80
|
}
|
81
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
81
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
82
82
|
end
|
83
83
|
|
84
84
|
# rubocop:disable Metrics/ParameterLists
|
@@ -118,7 +118,7 @@ module Auth0
|
|
118
118
|
audience: audience,
|
119
119
|
grant_type: realm ? 'http://auth0.com/oauth/grant-type/password-realm' : 'password'
|
120
120
|
}
|
121
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
121
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
122
122
|
end
|
123
123
|
# rubocop:enable Metrics/ParameterLists
|
124
124
|
|
@@ -292,220 +292,6 @@ module Auth0
|
|
292
292
|
)
|
293
293
|
end
|
294
294
|
|
295
|
-
#
|
296
|
-
# DEPRECATED
|
297
|
-
#
|
298
|
-
|
299
|
-
# Retrieve an access token.
|
300
|
-
# @deprecated 4.6.0 - Use the api_token method instead.
|
301
|
-
# @see https://auth0.com/docs/api/authentication#client-credentials
|
302
|
-
# @param access_token [string] Social provider's access_token
|
303
|
-
# @param connection [string] Currently, this endpoint only works for Facebook, Google, Twitter and Weibo
|
304
|
-
# @return [json] Returns the access token
|
305
|
-
def obtain_access_token(access_token = nil, connection = 'facebook', scope = 'openid')
|
306
|
-
if access_token
|
307
|
-
request_params = { client_id: @client_id, access_token: access_token, connection: connection, scope: scope }
|
308
|
-
post('/oauth/access_token', request_params)['access_token']
|
309
|
-
else
|
310
|
-
request_params = { client_id: @client_id, client_secret: @client_secret, grant_type: 'client_credentials' }
|
311
|
-
post('/oauth/token', request_params)['access_token']
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
# Get access and ID tokens using an Authorization Code.
|
316
|
-
# @deprecated 4.6.0 - Use the exchange_auth_code_for_tokens method instead.
|
317
|
-
# @see https://auth0.com/docs/api/authentication#authorization-code
|
318
|
-
# @param code [string] The access code obtained through passive authentication
|
319
|
-
# @param redirect_uri [string] Url to redirect after authorization
|
320
|
-
# @param connection [string] Currently, this endpoint only works for Facebook, Google, Twitter and Weibo
|
321
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email', 'openid offline_access'
|
322
|
-
# @return [json] Returns the access_token and id_token
|
323
|
-
def obtain_user_tokens(code, redirect_uri, connection = 'facebook', scope = 'openid')
|
324
|
-
raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?
|
325
|
-
raise Auth0::InvalidParameter, 'Must supply a valid redirect_uri' if redirect_uri.to_s.empty?
|
326
|
-
|
327
|
-
request_params = {
|
328
|
-
client_id: @client_id,
|
329
|
-
client_secret: @client_secret,
|
330
|
-
connection: connection,
|
331
|
-
grant_type: 'authorization_code',
|
332
|
-
code: code,
|
333
|
-
scope: scope,
|
334
|
-
redirect_uri: redirect_uri
|
335
|
-
}
|
336
|
-
post('/oauth/token', request_params)
|
337
|
-
end
|
338
|
-
|
339
|
-
# Get access and ID tokens using Resource Owner Password.
|
340
|
-
# @deprecated 4.6.0 - Use the login_with_resource_owner method instead.
|
341
|
-
# @see https://auth0.com/docs/api/authentication#resource-owner-password
|
342
|
-
# @param username [string] Username or email
|
343
|
-
# @param password [string] Password
|
344
|
-
# @param id_token [string] Token's id
|
345
|
-
# @param connection_name [string] Connection name; use a database or
|
346
|
-
# passwordless connection, Active Directory/LDAP, Windows Azure or ADF
|
347
|
-
# @param options [hash] Additional options - :scope, :grant_type, :device
|
348
|
-
# @return [json] Returns the access_token and id_token
|
349
|
-
def login(username, password, id_token = nil, connection_name = UP_AUTH, options = {})
|
350
|
-
raise Auth0::InvalidParameter, 'Must supply a valid username' if username.to_s.empty?
|
351
|
-
raise Auth0::InvalidParameter, 'Must supply a valid password' if password.to_s.empty?
|
352
|
-
|
353
|
-
request_params = {
|
354
|
-
client_id: @client_id,
|
355
|
-
client_secret: @client_secret,
|
356
|
-
username: username,
|
357
|
-
password: password,
|
358
|
-
scope: options.fetch(:scope, 'openid'),
|
359
|
-
connection: connection_name,
|
360
|
-
grant_type: options.fetch(:grant_type, 'password'),
|
361
|
-
id_token: id_token,
|
362
|
-
device: options.fetch(:device, nil)
|
363
|
-
}
|
364
|
-
post('/oauth/token', request_params)
|
365
|
-
end
|
366
|
-
|
367
|
-
# Return the user information based on the Auth0 access token.
|
368
|
-
# @deprecated 4.6.0 - Use the userinfo method instead.
|
369
|
-
# @see https://auth0.com/docs/api/authentication#get-user-info
|
370
|
-
# @return [json] User information based on the Auth0 access token
|
371
|
-
def user_info
|
372
|
-
get('/userinfo')
|
373
|
-
end
|
374
|
-
|
375
|
-
# Login using phone number + verification code.
|
376
|
-
# @deprecated 4.5.0 - Legacy authentication pipeline; use a Password Grant
|
377
|
-
# instead - https://auth0.com/docs/api-auth/tutorials/password-grant
|
378
|
-
# @see https://auth0.com/docs/api/authentication#resource-owner
|
379
|
-
# @param phone_number [string] User's phone number.
|
380
|
-
# @param code [string] Verification code.
|
381
|
-
# @return [json] Returns the access token and id token
|
382
|
-
def phone_login(phone_number, code, scope = 'openid')
|
383
|
-
raise Auth0::InvalidParameter, 'Must supply a valid phone number' if phone_number.to_s.empty?
|
384
|
-
raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?
|
385
|
-
|
386
|
-
request_params = {
|
387
|
-
client_id: @client_id,
|
388
|
-
username: phone_number,
|
389
|
-
password: code,
|
390
|
-
scope: scope,
|
391
|
-
connection: 'sms',
|
392
|
-
grant_type: 'password'
|
393
|
-
}
|
394
|
-
post('/oauth/ro', request_params)
|
395
|
-
end
|
396
|
-
|
397
|
-
# Validate a JSON Web Token (signature and expiration).
|
398
|
-
# @deprecated 4.5.0 - Legacy endpoint, use /userinfo instead.
|
399
|
-
# @see https://auth0.com/docs/api/authentication#get-token-info
|
400
|
-
# @param id_token [string] ID Token to use
|
401
|
-
# @return User information associated with the user id (sub property) of the token.
|
402
|
-
def token_info(id_token)
|
403
|
-
raise Auth0::InvalidParameter, 'Must supply a valid id_token' if id_token.to_s.empty?
|
404
|
-
|
405
|
-
request_params = { id_token: id_token }
|
406
|
-
post('/tokeninfo', request_params)
|
407
|
-
end
|
408
|
-
|
409
|
-
# Refresh a delegation token.
|
410
|
-
# @deprecated 4.5.0 - Feature is disabled, no replacement currently; see
|
411
|
-
# https://auth0.com/docs/api-auth/tutorials/adoption/delegation
|
412
|
-
# @see https://auth0.com/docs/api/authentication#delegation
|
413
|
-
# @param refresh_token [string] Token to refresh
|
414
|
-
# @param target [string] Target to sign the new token.
|
415
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email'.
|
416
|
-
# @param api_type [string] Defaults to app. Can be aws, azure_sb, azure_blob, firebase, layer, salesforce_api,
|
417
|
-
# salesforce_sandbox_api, sap_api or wams
|
418
|
-
# @param extra_parameters [hash] Extra parameters.
|
419
|
-
# @return [json] Returns the refreshed delegation token
|
420
|
-
def refresh_delegation(refresh_token, target, scope = 'openid', api_type = 'app', extra_parameters = {})
|
421
|
-
raise Auth0::InvalidParameter, 'Must supply a valid token to refresh' if refresh_token.to_s.empty?
|
422
|
-
|
423
|
-
request_params = {
|
424
|
-
client_id: @client_id,
|
425
|
-
grant_type: JWT_BEARER,
|
426
|
-
refresh_token: refresh_token,
|
427
|
-
target: target,
|
428
|
-
api_type: api_type,
|
429
|
-
scope: scope
|
430
|
-
}.merge(extra_parameters)
|
431
|
-
post('/delegation', request_params)
|
432
|
-
end
|
433
|
-
|
434
|
-
# Retrieve a delegation token.
|
435
|
-
# @deprecated 4.5.0 - Feature is disabled, no replacement currently; see
|
436
|
-
# https://auth0.com/docs/api-auth/tutorials/adoption/delegation
|
437
|
-
# @see https://auth0.com/docs/api/authentication#delegation
|
438
|
-
# @param id_token [string] Token's id.
|
439
|
-
# @param target [string] Target to sign the new token.
|
440
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email'.
|
441
|
-
# @param api_type [string] Defaults to app. Can be aws, azure_sb, azure_blob, firebase, layer, salesforce_api,
|
442
|
-
# salesforce_sandbox_api, sap_api or wams
|
443
|
-
# @param extra_parameters [hash] Extra parameters.
|
444
|
-
# @return [json] Returns the refreshed delegation token
|
445
|
-
def delegation(id_token, target, scope = 'openid', api_type = 'app', extra_parameters = {})
|
446
|
-
raise Auth0::InvalidParameter, 'Must supply a valid id_token' if id_token.to_s.empty?
|
447
|
-
|
448
|
-
request_params = {
|
449
|
-
client_id: @client_id,
|
450
|
-
grant_type: JWT_BEARER,
|
451
|
-
id_token: id_token,
|
452
|
-
target: target,
|
453
|
-
api_type: api_type,
|
454
|
-
scope: scope
|
455
|
-
}.merge(extra_parameters)
|
456
|
-
post('/delegation', request_params)
|
457
|
-
end
|
458
|
-
|
459
|
-
# Retrieve an impersonation URL to login as another user.
|
460
|
-
# @deprecated 4.5.0 - Feature is disabled.
|
461
|
-
# @see https://auth0.com/docs/api/authentication#impersonation
|
462
|
-
# @param user_id [string] Impersonate user id
|
463
|
-
# @param app_client_id [string] Application client id
|
464
|
-
# @param impersonator_id [string] Impersonator user id id.
|
465
|
-
# @param options [string] Additional Parameters
|
466
|
-
# @return [string] Impersonation URL
|
467
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
468
|
-
def impersonate(user_id, app_client_id, impersonator_id, options)
|
469
|
-
raise Auth0::InvalidParameter, 'Must supply a valid user_id' if user_id.to_s.empty?
|
470
|
-
raise Auth0::InvalidParameter, 'Must supply a valid app_client_id' if app_client_id.to_s.empty?
|
471
|
-
raise Auth0::InvalidParameter, 'Must supply a valid impersonator_id' if impersonator_id.to_s.empty?
|
472
|
-
raise Auth0::MissingParameter, 'Must supply client_secret' if @client_secret.nil?
|
473
|
-
|
474
|
-
authorization_header obtain_access_token
|
475
|
-
request_params = {
|
476
|
-
protocol: options.fetch(:protocol, 'oauth2'),
|
477
|
-
impersonator_id: impersonator_id,
|
478
|
-
client_id: app_client_id,
|
479
|
-
additionalParameters: {
|
480
|
-
response_type: options.fetch(:response_type, 'code'),
|
481
|
-
state: options.fetch(:state, ''),
|
482
|
-
scope: options.fetch(:scope, 'openid'),
|
483
|
-
callback_url: options.fetch(:callback_url, '')
|
484
|
-
}
|
485
|
-
}
|
486
|
-
result = post("/users/#{user_id}/impersonate", request_params)
|
487
|
-
authorization_header @token
|
488
|
-
result
|
489
|
-
end
|
490
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
491
|
-
|
492
|
-
# Unlink a user's account from the identity provider.
|
493
|
-
# @deprecated 4.5.0 - Endpoint is disabled in favor of the Management API;
|
494
|
-
# see https://auth0.com/docs/migrations/guides/account-linking
|
495
|
-
# @see https://auth0.com/docs/api/authentication#unlink
|
496
|
-
# @param access_token [string] Logged-in user access token
|
497
|
-
# @param user_id [string] User Id
|
498
|
-
def unlink_user(access_token, user_id)
|
499
|
-
raise Auth0::InvalidParameter, 'Must supply a valid access_token' if access_token.to_s.empty?
|
500
|
-
raise Auth0::InvalidParameter, 'Must supply a valid user_id' if user_id.to_s.empty?
|
501
|
-
|
502
|
-
request_params = {
|
503
|
-
access_token: access_token,
|
504
|
-
user_id: user_id
|
505
|
-
}
|
506
|
-
post('/unlink', request_params)
|
507
|
-
end
|
508
|
-
|
509
295
|
# Validate an ID token (signature and expiration).
|
510
296
|
# @see https://auth0.com/docs/tokens/guides/validate-id-tokens
|
511
297
|
# @param id_token [string] The JWT to validate.
|