auth0-ruby 0.9.1 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile.lock +2 -4
- data/auth0.gemspec +0 -1
- data/doc/Auth0.html +3 -3
- data/doc/Auth0/AccessDenied.html +142 -0
- data/doc/Auth0/Api.html +3 -3
- data/doc/Auth0/Api/AuthenticationEndpoints.html +3 -7
- data/doc/Auth0/Api/V1.html +4 -8
- data/doc/Auth0/Api/V1/Clients.html +1 -1
- data/doc/Auth0/Api/V1/Connections.html +1 -1
- data/doc/Auth0/Api/V1/Logs.html +1 -1
- data/doc/Auth0/Api/V1/Rules.html +1 -1
- data/doc/Auth0/Api/V1/Users.html +1 -1
- data/doc/Auth0/Api/V2.html +193 -0
- data/doc/Auth0/Api/V2/Blacklists.html +268 -0
- data/doc/Auth0/Api/V2/Clients.html +477 -0
- data/doc/Auth0/Api/V2/Jobs.html +277 -0
- data/doc/Auth0/Api/V2/Router.html +109 -0
- data/doc/Auth0/Api/V2/Stats.html +268 -0
- data/doc/Auth0/Api/V2/Users.html +652 -0
- data/doc/Auth0/BadRequest.html +1 -1
- data/doc/Auth0/Client.html +1 -73
- data/doc/Auth0/Exception.html +2 -2
- data/doc/Auth0/InvalidParameter.html +142 -0
- data/doc/Auth0/Mixins.html +4 -76
- data/doc/Auth0/Mixins/HTTPartyProxy.html +1 -1
- data/doc/Auth0/Mixins/Initializer.html +20 -14
- data/doc/Auth0/NotFound.html +1 -1
- data/doc/Auth0/ServerError.html +1 -1
- data/doc/Auth0/Unauthorized.html +1 -1
- data/doc/Auth0/Unsupported.html +1 -1
- data/doc/Auth0/UserIdIsBlank.html +1 -1
- data/doc/Auth0Client.html +1 -73
- data/doc/_index.html +59 -3
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +132 -30
- data/doc/top-level-namespace.html +1 -1
- data/lib/auth0/api/v2.rb +19 -0
- data/lib/auth0/api/v2/blacklists.rb +22 -0
- data/lib/auth0/api/v2/clients.rb +39 -0
- data/lib/auth0/api/v2/jobs.rb +20 -0
- data/lib/auth0/api/v2/router.rb +28 -0
- data/lib/auth0/api/v2/stats.rb +22 -0
- data/lib/auth0/api/v2/users.rb +64 -0
- data/lib/auth0/exception.rb +5 -1
- data/lib/auth0/mixins.rb +2 -3
- data/lib/auth0/mixins/httparty_proxy.rb +7 -1
- data/lib/auth0/mixins/initializer.rb +13 -8
- data/lib/auth0/version.rb +1 -1
- data/spec/lib/auth0/api/v2/blacklists_spec.rb +25 -0
- data/spec/lib/auth0/api/v2/clients_spec.rb +55 -0
- data/spec/lib/auth0/api/v2/jobs_spec.rb +22 -0
- data/spec/lib/auth0/api/v2/stats_spec.rb +23 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +73 -0
- data/spec/lib/auth0/client_spec.rb +31 -8
- data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +60 -1
- data/spec/lib/auth0_client_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +25 -37
- data/doc/Auth0/Mixins/JwtOperations.html +0 -202
- data/lib/auth0/mixins/jwt_operations.rb +0 -14
- data/spec/lib/auth0/mixins/jwt_operations_spec.rb +0 -31
- 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
|