auth0 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +2 -1
  4. data/.rubocop_todo.yml +0 -2
  5. data/.travis.yml +4 -2
  6. data/CHANGELOG.md +40 -38
  7. data/DEPLOYMENT.md +5 -0
  8. data/Gemfile +1 -1
  9. data/README.md +20 -2
  10. data/Rakefile +1 -1
  11. data/auth0.gemspec +4 -3
  12. data/doc_config/templates/default/layout/html/footer.erb +1 -1
  13. data/examples/ruby-api/.gitignore +86 -0
  14. data/examples/ruby-api/Gemfile +8 -0
  15. data/examples/ruby-api/README.md +24 -0
  16. data/examples/ruby-api/config.ru +2 -0
  17. data/examples/ruby-api/main.rb +33 -0
  18. data/examples/ruby-on-rails-api/.gitignore +18 -0
  19. data/examples/ruby-on-rails-api/Gemfile +48 -0
  20. data/examples/ruby-on-rails-api/README.md +27 -0
  21. data/examples/ruby-on-rails-api/Rakefile +6 -0
  22. data/examples/ruby-on-rails-api/app/assets/images/.keep +0 -0
  23. data/examples/ruby-on-rails-api/app/assets/javascripts/application.js +16 -0
  24. data/examples/ruby-on-rails-api/app/assets/stylesheets/application.css +15 -0
  25. data/examples/ruby-on-rails-api/app/controllers/application_controller.rb +8 -0
  26. data/examples/ruby-on-rails-api/app/controllers/concerns/.keep +0 -0
  27. data/examples/ruby-on-rails-api/app/controllers/ping_controller.rb +6 -0
  28. data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +11 -0
  29. data/examples/ruby-on-rails-api/app/helpers/application_helper.rb +3 -0
  30. data/examples/ruby-on-rails-api/app/mailers/.keep +0 -0
  31. data/examples/ruby-on-rails-api/app/models/.keep +0 -0
  32. data/examples/ruby-on-rails-api/app/models/concerns/.keep +0 -0
  33. data/examples/ruby-on-rails-api/app/views/layouts/application.html.erb +14 -0
  34. data/examples/ruby-on-rails-api/bin/bundle +3 -0
  35. data/examples/ruby-on-rails-api/bin/rails +4 -0
  36. data/examples/ruby-on-rails-api/bin/rake +4 -0
  37. data/examples/ruby-on-rails-api/bin/setup +29 -0
  38. data/examples/ruby-on-rails-api/config.ru +4 -0
  39. data/examples/ruby-on-rails-api/config/application.rb +23 -0
  40. data/examples/ruby-on-rails-api/config/boot.rb +4 -0
  41. data/examples/ruby-on-rails-api/config/database.yml +27 -0
  42. data/examples/ruby-on-rails-api/config/environment.rb +5 -0
  43. data/examples/ruby-on-rails-api/config/environments/development.rb +37 -0
  44. data/examples/ruby-on-rails-api/config/environments/production.rb +83 -0
  45. data/examples/ruby-on-rails-api/config/environments/test.rb +41 -0
  46. data/examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb +7 -0
  47. data/examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb +3 -0
  48. data/examples/ruby-on-rails-api/config/initializers/dotenv.rb +4 -0
  49. data/examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/examples/ruby-on-rails-api/config/initializers/inflections.rb +16 -0
  51. data/examples/ruby-on-rails-api/config/initializers/knock.rb +53 -0
  52. data/examples/ruby-on-rails-api/config/initializers/mime_types.rb +4 -0
  53. data/examples/ruby-on-rails-api/config/initializers/session_store.rb +3 -0
  54. data/examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb +14 -0
  55. data/examples/ruby-on-rails-api/config/locales/en.yml +23 -0
  56. data/examples/ruby-on-rails-api/config/routes.rb +58 -0
  57. data/examples/ruby-on-rails-api/config/secrets.yml +28 -0
  58. data/examples/ruby-on-rails-api/db/schema.rb +15 -0
  59. data/examples/ruby-on-rails-api/db/seeds.rb +7 -0
  60. data/examples/ruby-on-rails-api/lib/assets/.keep +0 -0
  61. data/examples/ruby-on-rails-api/lib/tasks/.keep +0 -0
  62. data/examples/ruby-on-rails-api/log/.keep +0 -0
  63. data/examples/ruby-on-rails-api/public/404.html +67 -0
  64. data/examples/ruby-on-rails-api/public/422.html +67 -0
  65. data/examples/ruby-on-rails-api/public/500.html +66 -0
  66. data/examples/ruby-on-rails-api/public/favicon.ico +0 -0
  67. data/examples/ruby-on-rails-api/public/robots.txt +5 -0
  68. data/examples/ruby-on-rails-api/test/controllers/.keep +0 -0
  69. data/examples/ruby-on-rails-api/test/fixtures/.keep +0 -0
  70. data/examples/ruby-on-rails-api/test/helpers/.keep +0 -0
  71. data/examples/ruby-on-rails-api/test/integration/.keep +0 -0
  72. data/examples/ruby-on-rails-api/test/mailers/.keep +0 -0
  73. data/examples/ruby-on-rails-api/test/models/.keep +0 -0
  74. data/examples/ruby-on-rails-api/test/ping_controller_test.rb +8 -0
  75. data/examples/ruby-on-rails-api/test/secured_ping_controller_test.rb +26 -0
  76. data/examples/ruby-on-rails-api/test/test_helper.rb +16 -0
  77. data/lib/auth0/api/authentication_endpoints.rb +59 -30
  78. data/lib/auth0/api/v1/clients.rb +1 -1
  79. data/lib/auth0/api/v1/connections.rb +4 -3
  80. data/lib/auth0/api/v1/logs.rb +1 -1
  81. data/lib/auth0/api/v1/rules.rb +1 -1
  82. data/lib/auth0/api/v1/users.rb +5 -5
  83. data/lib/auth0/api/v2.rb +10 -0
  84. data/lib/auth0/api/v2/blacklists.rb +1 -1
  85. data/lib/auth0/api/v2/client_grants.rb +57 -0
  86. data/lib/auth0/api/v2/clients.rb +14 -14
  87. data/lib/auth0/api/v2/connections.rb +19 -20
  88. data/lib/auth0/api/v2/device_credentials.rb +76 -0
  89. data/lib/auth0/api/v2/emails.rb +5 -7
  90. data/lib/auth0/api/v2/jobs.rb +15 -12
  91. data/lib/auth0/api/v2/logs.rb +65 -0
  92. data/lib/auth0/api/v2/resource_servers.rb +61 -0
  93. data/lib/auth0/api/v2/rules.rb +21 -20
  94. data/lib/auth0/api/v2/stats.rb +2 -2
  95. data/lib/auth0/api/v2/tenants.rb +6 -4
  96. data/lib/auth0/api/v2/tickets.rb +13 -14
  97. data/lib/auth0/api/v2/user_blocks.rb +62 -0
  98. data/lib/auth0/api/v2/users.rb +63 -32
  99. data/lib/auth0/client.rb +0 -2
  100. data/lib/auth0/mixins.rb +4 -3
  101. data/lib/auth0/mixins/httpproxy.rb +55 -0
  102. data/lib/auth0/mixins/initializer.rb +27 -10
  103. data/lib/auth0/version.rb +1 -1
  104. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +118 -0
  105. data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +1 -1
  106. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +53 -0
  107. data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +5 -2
  108. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +8 -5
  109. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +67 -0
  110. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +15 -8
  111. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +11 -9
  112. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +69 -0
  113. data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +47 -0
  114. data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +2 -1
  115. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +2 -2
  116. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +73 -0
  117. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +32 -5
  118. data/spec/integration/lib/auth0/auth0_client_spec.rb +14 -11
  119. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +116 -56
  120. data/spec/lib/auth0/api/v1/connections_spec.rb +2 -4
  121. data/spec/lib/auth0/api/v1/rules_spec.rb +2 -1
  122. data/spec/lib/auth0/api/v1/users_spec.rb +17 -9
  123. data/spec/lib/auth0/api/v2/client_grants_spec.rb +44 -0
  124. data/spec/lib/auth0/api/v2/connections_spec.rb +2 -1
  125. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +73 -0
  126. data/spec/lib/auth0/api/v2/jobs_spec.rb +3 -2
  127. data/spec/lib/auth0/api/v2/logs_spec.rb +48 -0
  128. data/spec/lib/auth0/api/v2/resource_servers_spec.rb +63 -0
  129. data/spec/lib/auth0/api/v2/rules_spec.rb +8 -4
  130. data/spec/lib/auth0/api/v2/tenants_spec.rb +2 -1
  131. data/spec/lib/auth0/api/v2/tickets_spec.rb +4 -7
  132. data/spec/lib/auth0/api/v2/user_blocks_spec.rb +52 -0
  133. data/spec/lib/auth0/api/v2/users_spec.rb +39 -6
  134. data/spec/lib/auth0/client_spec.rb +8 -5
  135. data/spec/lib/auth0/mixins/httpproxy_spec.rb +225 -0
  136. data/spec/lib/auth0/mixins/initializer_spec.rb +1 -1
  137. data/spec/spec_helper_full.rb +12 -3
  138. data/spec/spec_helper_unit.rb +2 -2
  139. data/spec/support/credentials.rb +6 -4
  140. data/spec/support/dummy_class.rb +2 -1
  141. data/spec/support/dummy_class_for_proxy.rb +2 -2
  142. data/spec/support/dummy_class_for_restclient.rb +2 -0
  143. metadata +117 -9
  144. data/lib/auth0/mixins/httparty_proxy.rb +0 -38
  145. data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +0 -148
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f3bb45bf30f872a1dd2eb91a1c61e6a035deb69
4
- data.tar.gz: dd7232699e2ead49e80f1ed37024a1931df5aeb2
3
+ metadata.gz: 5662a97be797b89462c17138a8f056908bbd1bd9
4
+ data.tar.gz: 9973f4c3a23a12e1888c9da0751030def1259601
5
5
  SHA512:
6
- metadata.gz: e338485145e37a809f8a3742ef6dbee6e198ab0c0fe2f6569d8dac7406d89a3723854e25baa29456a1a44617efdf7b781f078ec0c673e47591fec2d5bee95ef9
7
- data.tar.gz: 6a7b9ef6a8a52184a12c5926a1954ad568a82420ff9d3aa67a3ae7583cc8d6f47520c15fcded1ac10e80ca7fc0209532d54d7aff1dcfa2f219cc781604ceff4e
6
+ metadata.gz: 972202c41cb9e9f479f50479075daeaa33af13a3ac88ce94bff273267bad13b1f5ef56f03f300f9cd2845f576be9c91204c23dccac11f9a9dd51f5d1639cf316
7
+ data.tar.gz: cde76230c835cdf52f2e963edbd28bc794efb769c892739bfd70029954b6ad23c25a62b8a10285d21839d7c0fc09a300f005d6ab3cf2fd6147be2413b8761dcb
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  bin/
2
+ !examples/ruby-on-rails-api/bin/
2
3
  vendor/
3
4
  doc/
4
5
  .DS_Store
@@ -1,6 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+ Rails:
3
+ Enabled: true
2
4
  AllCops:
3
- RunRailsCops: true
4
5
  Exclude:
5
6
  - bin/**/*
6
7
  - vendor/**/*
@@ -1,7 +1,5 @@
1
- # Configuration parameters: CountComments.
2
1
  Metrics/MethodLength:
3
2
  Max: 15
4
3
 
5
- # Configuration parameters: AllowURI, URISchemes.
6
4
  Metrics/LineLength:
7
5
  Max: 121
@@ -1,9 +1,11 @@
1
+ ---
1
2
  language: ruby
2
3
  sudo: false
3
4
  cache: bundler
4
5
  rvm:
5
- - 2.1.0
6
- - 2.2.1
6
+ - 2.1.9
7
+ - 2.2.5
8
+ - 2.3.1
7
9
  script: "./build_travis.sh"
8
10
  after_success: "./deploy_documentation.sh"
9
11
  deploy:
@@ -1,29 +1,63 @@
1
1
  # Change Log
2
2
 
3
- ## [v3.6.1](https://github.com/auth0/ruby-auth0/tree/v3.6.1) (2015-07-09)
3
+ ## [v4.1.0](https://github.com/auth0/ruby-auth0/tree/v4.1.0) (2016-07-25)
4
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.0.0...v4.1.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - \#post\_password\_change requires a password for ticket. [\#69](https://github.com/auth0/ruby-auth0/issues/69)
9
+ - Exception messages are ruby hash string literals [\#63](https://github.com/auth0/ruby-auth0/issues/63)
10
+ - Ruby on Rails API issue [\#61](https://github.com/auth0/ruby-auth0/issues/61)
11
+ - Not possible to have V1 and V2 clients at the same time [\#60](https://github.com/auth0/ruby-auth0/issues/60)
12
+ - Be able to control timeout [\#57](https://github.com/auth0/ruby-auth0/issues/57)
13
+ - Version 4 changes [\#54](https://github.com/auth0/ruby-auth0/issues/54)
14
+ - Implement API v2 [\#38](https://github.com/auth0/ruby-auth0/issues/38)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Release 4.1.0 [\#71](https://github.com/auth0/ruby-auth0/pull/71) ([ignaciojonas](https://github.com/ignaciojonas))
19
+ - Use JSON \(result.body\) for exception messages in requests [\#67](https://github.com/auth0/ruby-auth0/pull/67) ([ianks](https://github.com/ianks))
20
+ - fixed rails api doesn't start, now impersionated links works with v2 [\#62](https://github.com/auth0/ruby-auth0/pull/62) ([Amialc](https://github.com/Amialc))
21
+ - Add api v2 log endpoints to the gem [\#59](https://github.com/auth0/ruby-auth0/pull/59) ([LindseyB](https://github.com/LindseyB))
22
+
23
+ ## [v4.0.0](https://github.com/auth0/ruby-auth0/tree/v4.0.0) (2016-02-12)
24
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.6.1...v4.0.0)
25
+
26
+ **Closed issues:**
27
+
28
+ - Update LICENSE [\#47](https://github.com/auth0/ruby-auth0/issues/47)
29
+ - Integration tests [\#15](https://github.com/auth0/ruby-auth0/issues/15)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - V2 - Rebased to Master [\#53](https://github.com/auth0/ruby-auth0/pull/53) ([ignaciojonas](https://github.com/ignaciojonas))
34
+ - V2 - Auth Endpoints + Gem deployment [\#50](https://github.com/auth0/ruby-auth0/pull/50) ([ignaciojonas](https://github.com/ignaciojonas))
35
+ - Documentation Style [\#49](https://github.com/auth0/ruby-auth0/pull/49) ([ignaciojonas](https://github.com/ignaciojonas))
36
+ - Update License [\#48](https://github.com/auth0/ruby-auth0/pull/48) ([aguerere](https://github.com/aguerere))
37
+ - API v2 Implementation [\#46](https://github.com/auth0/ruby-auth0/pull/46) ([ignaciojonas](https://github.com/ignaciojonas))
38
+ - Refresh token delegation [\#43](https://github.com/auth0/ruby-auth0/pull/43) ([LindseyB](https://github.com/LindseyB))
39
+ - Fix tests to make build green [\#41](https://github.com/auth0/ruby-auth0/pull/41) ([leosoubeste](https://github.com/leosoubeste))
40
+ - Rubocop Integration [\#39](https://github.com/auth0/ruby-auth0/pull/39) ([ignaciojonas](https://github.com/ignaciojonas))
41
+ - Remove semi-colons in README [\#37](https://github.com/auth0/ruby-auth0/pull/37) ([l4u](https://github.com/l4u))
4
42
 
43
+ ## [v3.6.1](https://github.com/auth0/ruby-auth0/tree/v3.6.1) (2015-07-09)
5
44
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.6.0...v3.6.1)
6
45
 
7
46
  **Merged pull requests:**
8
47
 
9
48
  - set the search engine if a query is set [\#36](https://github.com/auth0/ruby-auth0/pull/36) ([taylorfinnell](https://github.com/taylorfinnell))
10
-
11
49
  - email validation is broken by \_, which breaks the tests [\#35](https://github.com/auth0/ruby-auth0/pull/35) ([taylorfinnell](https://github.com/taylorfinnell))
12
50
 
13
51
  ## [v3.6.0](https://github.com/auth0/ruby-auth0/tree/v3.6.0) (2015-06-01)
14
-
15
52
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.5.0...v3.6.0)
16
53
 
17
54
  **Merged pull requests:**
18
55
 
19
56
  - Remove exclude\_fields parameter for getting users [\#34](https://github.com/auth0/ruby-auth0/pull/34) ([hzalaz](https://github.com/hzalaz))
20
-
21
57
  - Add connections [\#33](https://github.com/auth0/ruby-auth0/pull/33) ([taylorfinnell](https://github.com/taylorfinnell))
22
-
23
58
  - Use client header spec as per documentation [\#32](https://github.com/auth0/ruby-auth0/pull/32) ([benschwarz](https://github.com/benschwarz))
24
59
 
25
60
  ## [v3.5.0](https://github.com/auth0/ruby-auth0/tree/v3.5.0) (2015-05-21)
26
-
27
61
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.4.0...v3.5.0)
28
62
 
29
63
  **Merged pull requests:**
@@ -31,83 +65,51 @@
31
65
  - Client information headers [\#31](https://github.com/auth0/ruby-auth0/pull/31) ([benschwarz](https://github.com/benschwarz))
32
66
 
33
67
  ## [v3.4.0](https://github.com/auth0/ruby-auth0/tree/v3.4.0) (2015-05-07)
34
-
35
68
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.3.0...v3.4.0)
36
69
 
37
70
  **Closed issues:**
38
71
 
39
72
  - Changelog [\#29](https://github.com/auth0/ruby-auth0/issues/29)
40
-
41
73
  - Tag releases [\#16](https://github.com/auth0/ruby-auth0/issues/16)
42
74
 
43
75
  **Merged pull requests:**
44
76
 
45
77
  - allow setting impersonation ttl [\#30](https://github.com/auth0/ruby-auth0/pull/30) ([seamusabshere](https://github.com/seamusabshere))
46
-
47
78
  - Fix broken link in README [\#28](https://github.com/auth0/ruby-auth0/pull/28) ([dentarg](https://github.com/dentarg))
48
79
 
49
80
  ## [v3.3.0](https://github.com/auth0/ruby-auth0/tree/v3.3.0) (2015-04-15)
50
-
51
81
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.2.0...v3.3.0)
52
82
 
53
83
  **Closed issues:**
54
84
 
55
85
  - AuthenticationEndpoints should be independent of the V1/V2 API [\#20](https://github.com/auth0/ruby-auth0/issues/20)
56
-
57
86
  - Typo in AuthenticationEndpoints.login [\#17](https://github.com/auth0/ruby-auth0/issues/17)
58
-
59
87
  - Remove generated docs [\#14](https://github.com/auth0/ruby-auth0/issues/14)
60
-
61
88
  - Remove the examples directory from this repository [\#4](https://github.com/auth0/ruby-auth0/issues/4)
62
89
 
63
90
  **Merged pull requests:**
64
91
 
65
92
  - Chore integration tests [\#27](https://github.com/auth0/ruby-auth0/pull/27) ([hzalaz](https://github.com/hzalaz))
66
-
67
93
  - allow to pass extra parameters to delegation method [\#23](https://github.com/auth0/ruby-auth0/pull/23) ([Maxim-Filimonov](https://github.com/Maxim-Filimonov))
68
94
 
69
95
  ## [v3.2.0](https://github.com/auth0/ruby-auth0/tree/v3.2.0) (2015-04-14)
70
-
71
96
  **Merged pull requests:**
72
97
 
73
98
  - Impersonation [\#26](https://github.com/auth0/ruby-auth0/pull/26) ([dentarg](https://github.com/dentarg))
74
-
75
99
  - Allow to set api\_type to use with salesforce\_api [\#25](https://github.com/auth0/ruby-auth0/pull/25) ([Maxim-Filimonov](https://github.com/Maxim-Filimonov))
76
-
77
100
  - Fixed few issues from issues list [\#22](https://github.com/auth0/ruby-auth0/pull/22) ([offtop](https://github.com/offtop))
78
-
79
101
  - Update readme.md api v2 basic usage example [\#19](https://github.com/auth0/ruby-auth0/pull/19) ([ethancrawford](https://github.com/ethancrawford))
80
-
81
102
  - fix token initialization to prevent nil token value [\#18](https://github.com/auth0/ruby-auth0/pull/18) ([ethancrawford](https://github.com/ethancrawford))
82
-
83
103
  - Make the client work for API v1 [\#13](https://github.com/auth0/ruby-auth0/pull/13) ([dentarg](https://github.com/dentarg))
84
-
85
104
  - Fix typo delegation signature; open\_id =\> openid [\#12](https://github.com/auth0/ruby-auth0/pull/12) ([dentarg](https://github.com/dentarg))
86
-
87
105
  - Make the tests run on Travis CI [\#11](https://github.com/auth0/ruby-auth0/pull/11) ([dentarg](https://github.com/dentarg))
88
-
89
106
  - Added support for API V1 and API V2 [\#9](https://github.com/auth0/ruby-auth0/pull/9) ([offtop](https://github.com/offtop))
90
-
91
107
  - Update README.md [\#8](https://github.com/auth0/ruby-auth0/pull/8) ([pose](https://github.com/pose))
92
-
93
108
  - Make delete user safe [\#5](https://github.com/auth0/ruby-auth0/pull/5) ([dentarg](https://github.com/dentarg))
94
-
95
109
  - Remove the omniauth strategy [\#3](https://github.com/auth0/ruby-auth0/pull/3) ([dentarg](https://github.com/dentarg))
96
-
97
110
  - Fix rspec deprecation warning [\#2](https://github.com/auth0/ruby-auth0/pull/2) ([dentarg](https://github.com/dentarg))
98
-
99
111
  - Add method to access delegation endpoint [\#1](https://github.com/auth0/ruby-auth0/pull/1) ([FrancisPlaza](https://github.com/FrancisPlaza))
100
112
 
101
- - Authendpoint in v2 [\#24](https://github.com/auth0/ruby-auth0/pull/24) ([Maxim-Filimonov](https://github.com/Maxim-Filimonov))
102
-
103
- - make AuthenticationEndpoints available to client in v2 mode [\#21](https://github.com/auth0/ruby-auth0/pull/21) ([MungoH](https://github.com/MungoH))
104
-
105
- - updated webmock version, updated documentation [\#10](https://github.com/auth0/ruby-auth0/pull/10) ([offtop](https://github.com/offtop))
106
-
107
- - Add create user method [\#7](https://github.com/auth0/ruby-auth0/pull/7) ([dentarg](https://github.com/dentarg))
108
-
109
- - Add impersonation method [\#6](https://github.com/auth0/ruby-auth0/pull/6) ([dentarg](https://github.com/dentarg))
110
-
111
113
 
112
114
 
113
115
  \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -0,0 +1,5 @@
1
+ ```
2
+ bundle install
3
+ bundle exec rake spec
4
+ gem push auth0-X.Y.Z.gem
5
+ ```
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'http://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'terminal-notifier-guard', require: false
7
+ gem 'terminal-notifier-guard', require: false unless ENV['TRAVIS']
8
8
  gem 'coveralls', require: false
9
9
  gem 'rubocop', require: false
10
10
  gem 'yard', require: false
data/README.md CHANGED
@@ -25,8 +25,9 @@ Using [APIv2](https://auth0.com/docs/api/v2)
25
25
  require "auth0"
26
26
 
27
27
  auth0 = Auth0Client.new(
28
+ :client_id => "YOUR CLIENT ID"
28
29
  :token => "YOUR JWT HERE",
29
- :domain => "<YOUR ACCOUNT>.auth0.com"
30
+ :domain => "<YOUR ACCOUNT>.auth0.com"
30
31
  )
31
32
 
32
33
  puts auth0.get_users
@@ -40,7 +41,24 @@ require "auth0"
40
41
  auth0 = Auth0Client.new(
41
42
  :client_id => "YOUR CLIENT ID",
42
43
  :client_secret => "YOUR CLIENT SECRET",
43
- :domain => "<YOUR ACCOUNT>.auth0.com"
44
+ :domain => "<YOUR ACCOUNT>.auth0.com",
45
+ :api_version => "1"
46
+ )
47
+
48
+ puts auth0.get_users
49
+ ```
50
+
51
+ ### Timeout
52
+ You can setup a custom timeout in the Auth0Client. By default it is set to 10 minutes.
53
+
54
+ ```ruby
55
+ require "auth0"
56
+
57
+ auth0 = Auth0Client.new(
58
+ :client_id => "YOUR CLIENT ID"
59
+ :token => "YOUR JWT HERE",
60
+ :domain => "<YOUR ACCOUNT>.auth0.com",
61
+ :timeout => 15
44
62
  )
45
63
 
46
64
  puts auth0.get_users
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  RuboCop::RakeTask.new(:rubocop)
11
11
 
12
12
  require 'yard'
13
- DOC_FILES = ['lib/auth0/api/v2/*.rb', 'lib/auth0/api/authentication_endpoints.rb']
13
+ DOC_FILES = ['lib/auth0/api/v2/*.rb', 'lib/auth0/api/authentication_endpoints.rb'].freeze
14
14
 
15
15
  desc 'Build Documentation'
16
16
  YARD::Rake::YardocTask.new(:documentation) do |t|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = ['support@auth0.com']
10
10
  s.homepage = 'https://github.com/auth0/ruby-auth0'
11
11
  s.summary = 'Auth0 API Client'
12
- s.description = 'Ruby client library for the Auth0 API.'
12
+ s.description = 'Ruby toolkit for Auth0 API https://auth0.com.'
13
13
 
14
14
  s.rubyforge_project = 'auth0'
15
15
 
@@ -18,16 +18,17 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_runtime_dependency 'httmultiparty', '~> 0.3.16'
21
+ s.add_runtime_dependency 'rest-client', '~> 1.8.0'
22
22
 
23
23
  s.add_development_dependency 'rake', '~> 10.4'
24
24
  s.add_development_dependency 'fuubar', '~> 2.0'
25
- s.add_development_dependency 'guard-rspec', '~> 4.5'
25
+ s.add_development_dependency 'guard-rspec', '~> 4.5' unless ENV['TRAVIS']
26
26
  s.add_development_dependency 'dotenv-rails', '~> 2.0'
27
27
  s.add_development_dependency 'pry', '~> 0.10'
28
28
  s.add_development_dependency 'pry-nav', '~> 0.2.4'
29
29
  s.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
30
30
  s.add_development_dependency 'rack-test', '~> 0.6'
31
+ s.add_development_dependency 'rack', '~> 1.6.4'
31
32
  s.add_development_dependency 'simplecov', '~> 0.9'
32
33
  s.add_development_dependency 'faker', '~> 1.4'
33
34
  s.add_development_dependency 'yard', '~> 0.8'
@@ -80,7 +80,7 @@
80
80
  <div class="item">
81
81
  <a href="mailto:support@auth0.com">Email Us</a>
82
82
  </div>
83
- <div class="item item-text">10777 Main Street<br>Suite 204<br>Bellevue, WA 98004</div>
83
+ <div class="item item-text">10900 NE 8th St.<br>Suite 700<br>Bellevue, WA 98004</div>
84
84
  </div>
85
85
  <div class="column no-heading">
86
86
  <div class="item item-phone-label">Sales</div>
@@ -0,0 +1,86 @@
1
+ ### Ruby template
2
+ *.gem
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ ## Specific to RubyMotion:
15
+ .dat*
16
+ .repl_history
17
+ build/
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalisation:
26
+ /.bundle/
27
+ /vendor/bundle
28
+ /lib/bundler/man/
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+ # Gemfile.lock
33
+ # .ruby-version
34
+ # .ruby-gemset
35
+
36
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
37
+ .rvmrc
38
+ ### JetBrains template
39
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
40
+
41
+ *.iml
42
+
43
+ ## Directory-based project format:
44
+ .idea/
45
+ # if you remove the above rule, at least ignore the following:
46
+
47
+ # User-specific stuff:
48
+ # .idea/workspace.xml
49
+ # .idea/tasks.xml
50
+ # .idea/dictionaries
51
+
52
+ # Sensitive or high-churn files:
53
+ # .idea/dataSources.ids
54
+ # .idea/dataSources.xml
55
+ # .idea/sqlDataSources.xml
56
+ # .idea/dynamic.xml
57
+ # .idea/uiDesigner.xml
58
+
59
+ # Gradle:
60
+ # .idea/gradle.xml
61
+ # .idea/libraries
62
+
63
+ # Mongo Explorer plugin:
64
+ # .idea/mongoSettings.xml
65
+
66
+ ## File-based project format:
67
+ *.ipr
68
+ *.iws
69
+
70
+ ## Plugin-specific files:
71
+
72
+ # IntelliJ
73
+ /out/
74
+
75
+ # mpeltonen/sbt-idea plugin
76
+ .idea_modules/
77
+
78
+ # JIRA plugin
79
+ atlassian-ide-plugin.xml
80
+
81
+ # Crashlytics plugin (for Android Studio and IntelliJ)
82
+ com_crashlytics_export_strings.xml
83
+ crashlytics.properties
84
+ crashlytics-build.properties
85
+
86
+ .env
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # A sample Gemfile
3
+ source 'http://rubygems.org'
4
+
5
+ # gem "rails"
6
+ gem 'sinatra', '~> 1.4'
7
+ gem 'jwt', '~> 1.5'
8
+ gem 'dotenv'
@@ -0,0 +1,24 @@
1
+ #Auth0 + Ruby API Seed
2
+
3
+ This is the seed project you need to use if you're going to create a Ruby API. You'll mostly use this API either for a SPA or a Mobile app.
4
+
5
+ #Running the example
6
+
7
+ In order to run the example you need to have ruby installed.
8
+
9
+ You also need to set the ClientSecret and ClientId for your Auth0 app as enviroment variables with the following names respectively: AUTH0_CLIENT_SECRET and AUTH0_CLIENT_ID.
10
+
11
+ For that, if you just create a file named .env in the directory and set the values like the following, the app will just work:
12
+
13
+ ````bash
14
+ # .env file
15
+ AUTH0_CLIENT_SECRET=myCoolSecret
16
+ AUTH0_CLIENT_ID=myCoolClientId
17
+ ````
18
+
19
+ Once you've set those 2 enviroment variables, run `bundle install`, then run `rackup -p 3001` and try calling [http://localhost:3001/ping](http://localhost:3001/ping)
20
+
21
+ You can then try to do a GET to [http://localhost:3001/secured/ping](http://localhost:3001/secured/ping) which will throw an error if you don't send the JWT in the header.
22
+
23
+ __Note:__ if you need to enable cross-origin resource sharing, check out the [sinatra-cors_origin](
24
+ https://github.com/britg/sinatra-cross_origin) gem.
@@ -0,0 +1,2 @@
1
+ require './main'
2
+ run Sinatra::Application
@@ -0,0 +1,33 @@
1
+ require 'dotenv'
2
+ require 'jwt'
3
+ require 'sinatra'
4
+ Dotenv.load '.env'
5
+ set :show_exceptions, false
6
+
7
+ class InvalidTokenError < StandardError
8
+ end
9
+
10
+ def validate_token(env)
11
+ auth0_client_id = ENV['AUTH0_CLIENT_ID']
12
+ auth0_client_secret = ENV['AUTH0_CLIENT_SECRET']
13
+ authorization = env['HTTP_AUTHORIZATION']
14
+ raise InvalidTokenError if authorization.nil?
15
+ decoded_token = JWT.decode(authorization.split(' ').last, JWT.base64url_decode(auth0_client_secret))
16
+ raise InvalidTokenError if auth0_client_id != decoded_token[0]['aud']
17
+ 'You get this only if authenticated'
18
+ rescue JWT::DecodeError
19
+ raise InvalidTokenError
20
+ end
21
+
22
+ error InvalidTokenError do
23
+ 'Invalid token'
24
+ end
25
+
26
+ get '/secured/ping' do
27
+ validate_token env
28
+ 'All good. You can see it because token is valid'
29
+ end
30
+
31
+ get '/ping' do
32
+ 'ping'
33
+ end