auth0-ruby 0.9.1 → 0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/Gemfile.lock +2 -4
  4. data/auth0.gemspec +0 -1
  5. data/doc/Auth0.html +3 -3
  6. data/doc/Auth0/AccessDenied.html +142 -0
  7. data/doc/Auth0/Api.html +3 -3
  8. data/doc/Auth0/Api/AuthenticationEndpoints.html +3 -7
  9. data/doc/Auth0/Api/V1.html +4 -8
  10. data/doc/Auth0/Api/V1/Clients.html +1 -1
  11. data/doc/Auth0/Api/V1/Connections.html +1 -1
  12. data/doc/Auth0/Api/V1/Logs.html +1 -1
  13. data/doc/Auth0/Api/V1/Rules.html +1 -1
  14. data/doc/Auth0/Api/V1/Users.html +1 -1
  15. data/doc/Auth0/Api/V2.html +193 -0
  16. data/doc/Auth0/Api/V2/Blacklists.html +268 -0
  17. data/doc/Auth0/Api/V2/Clients.html +477 -0
  18. data/doc/Auth0/Api/V2/Jobs.html +277 -0
  19. data/doc/Auth0/Api/V2/Router.html +109 -0
  20. data/doc/Auth0/Api/V2/Stats.html +268 -0
  21. data/doc/Auth0/Api/V2/Users.html +652 -0
  22. data/doc/Auth0/BadRequest.html +1 -1
  23. data/doc/Auth0/Client.html +1 -73
  24. data/doc/Auth0/Exception.html +2 -2
  25. data/doc/Auth0/InvalidParameter.html +142 -0
  26. data/doc/Auth0/Mixins.html +4 -76
  27. data/doc/Auth0/Mixins/HTTPartyProxy.html +1 -1
  28. data/doc/Auth0/Mixins/Initializer.html +20 -14
  29. data/doc/Auth0/NotFound.html +1 -1
  30. data/doc/Auth0/ServerError.html +1 -1
  31. data/doc/Auth0/Unauthorized.html +1 -1
  32. data/doc/Auth0/Unsupported.html +1 -1
  33. data/doc/Auth0/UserIdIsBlank.html +1 -1
  34. data/doc/Auth0Client.html +1 -73
  35. data/doc/_index.html +59 -3
  36. data/doc/class_list.html +1 -1
  37. data/doc/file.README.html +1 -1
  38. data/doc/index.html +1 -1
  39. data/doc/method_list.html +132 -30
  40. data/doc/top-level-namespace.html +1 -1
  41. data/lib/auth0/api/v2.rb +19 -0
  42. data/lib/auth0/api/v2/blacklists.rb +22 -0
  43. data/lib/auth0/api/v2/clients.rb +39 -0
  44. data/lib/auth0/api/v2/jobs.rb +20 -0
  45. data/lib/auth0/api/v2/router.rb +28 -0
  46. data/lib/auth0/api/v2/stats.rb +22 -0
  47. data/lib/auth0/api/v2/users.rb +64 -0
  48. data/lib/auth0/exception.rb +5 -1
  49. data/lib/auth0/mixins.rb +2 -3
  50. data/lib/auth0/mixins/httparty_proxy.rb +7 -1
  51. data/lib/auth0/mixins/initializer.rb +13 -8
  52. data/lib/auth0/version.rb +1 -1
  53. data/spec/lib/auth0/api/v2/blacklists_spec.rb +25 -0
  54. data/spec/lib/auth0/api/v2/clients_spec.rb +55 -0
  55. data/spec/lib/auth0/api/v2/jobs_spec.rb +22 -0
  56. data/spec/lib/auth0/api/v2/stats_spec.rb +23 -0
  57. data/spec/lib/auth0/api/v2/users_spec.rb +73 -0
  58. data/spec/lib/auth0/client_spec.rb +31 -8
  59. data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +60 -1
  60. data/spec/lib/auth0_client_spec.rb +1 -1
  61. data/spec/spec_helper.rb +1 -1
  62. metadata +25 -37
  63. data/doc/Auth0/Mixins/JwtOperations.html +0 -202
  64. data/lib/auth0/mixins/jwt_operations.rb +0 -14
  65. data/spec/lib/auth0/mixins/jwt_operations_spec.rb +0 -31
  66. data/spec/support/stub_class_with_client_secret.rb +0 -7
@@ -1,14 +0,0 @@
1
- require 'jwt'
2
- module Auth0
3
- module Mixins
4
- # Working with JWT
5
- #
6
- # https://auth0.com/docs/jwt
7
- module JwtOperations
8
- # https://auth0.com/docs/server-apis/ruby
9
- def decode_jwt(token, client_secret=@client_secret)
10
- JWT.decode(token,Base64.decode64(client_secret.tr("-_","+/")))
11
- end
12
- end
13
- end
14
- end
@@ -1,31 +0,0 @@
1
- require "spec_helper"
2
- describe Auth0::Mixins::JwtOperations do
3
- let(:client_secret){"/-_+Authentic--++_"}
4
- let(:subject){StubClassWithClientSecret.new(client_secret)}
5
- let(:token){"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJteV9zZWNyZXQiOiJTb21lIGV4dHJlbWVseSBzZWNyZXQgZGF0YSJ9.2jD3ndQO7hTx1gfrYsrPst9WiibigORevZ_lUaNA8fY"}
6
- let(:escaped_client_secret) {"/+/+Authentic++++/"}
7
- let(:base64_decoded_client_secret){Base64.decode64(escaped_client_secret)}
8
- let(:decrypted_value){[{"my_secret"=>"Some extremely secret data"}, {"typ"=>"JWT", "alg"=>"HS256"}]}
9
- context "#decode" do
10
- it { expect(subject).to respond_to :decode_jwt}
11
- it "is expected to call tr on client secret" do
12
- allow(JWT).to receive(:decode)
13
- allow(Base64).to receive(:decode64)
14
- expect(subject.client_secret).to receive(:tr).with("-_","+/")
15
- expect{subject.decode_jwt(token)}.not_to raise_error
16
- end
17
- it "is expected to send decode64 to Base64" do
18
- allow(JWT).to receive(:decode)
19
- expect(Base64).to receive(:decode64).with(escaped_client_secret)
20
- expect{subject.decode_jwt(token)}.not_to raise_error
21
- end
22
- it "is expected to send decode to JWT" do
23
- allow(JWT).to receive(:decode).with(token,base64_decoded_client_secret)
24
- expect{subject.decode_jwt(token)}.not_to raise_error
25
- end
26
- it "is expected to return decrypted_value after decryption" do
27
- expect(subject.decode_jwt(token)).to eql decrypted_value
28
- end
29
- end
30
-
31
- end
@@ -1,7 +0,0 @@
1
- class StubClassWithClientSecret
2
- def initialize(client_secret)
3
- @client_secret = client_secret
4
- end
5
- include Auth0::Mixins::JwtOperations
6
- attr_accessor :client_secret
7
- end