auth0 5.10.0 → 5.13.0
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 +5 -4
 - data/.devcontainer/devcontainer.json +1 -1
 - data/.semgrepignore +6 -0
 - data/CHANGELOG.md +29 -0
 - data/DEVELOPMENT.md +35 -0
 - data/EXAMPLES.md +220 -0
 - data/Gemfile.lock +58 -66
 - data/README.md +67 -253
 - data/auth0.gemspec +0 -2
 - data/examples/ruby-api/Gemfile.lock +5 -4
 - data/examples/ruby-on-rails-api/README.md +0 -2
 - data/lib/auth0/api/authentication_endpoints.rb +107 -13
 - data/lib/auth0/api/v2/clients.rb +42 -0
 - data/lib/auth0/api/v2/users.rb +116 -0
 - data/lib/auth0/client_assertion.rb +45 -0
 - data/lib/auth0/mixins/httpproxy.rb +5 -2
 - data/lib/auth0/mixins/initializer.rb +2 -0
 - data/lib/auth0/mixins/token_management.rb +1 -1
 - data/lib/auth0/version.rb +1 -1
 - data/opslevel.yml +5 -0
 - data/spec/lib/auth0/api/authentication_endpoints_spec.rb +722 -0
 - data/spec/lib/auth0/api/v2/clients_spec.rb +51 -0
 - data/spec/lib/auth0/api/v2/users_spec.rb +218 -0
 - data/spec/lib/auth0/mixins/httpproxy_spec.rb +38 -77
 - data/spec/lib/auth0/mixins/initializer_spec.rb +79 -25
 - data/spec/lib/auth0/mixins/token_management_spec.rb +45 -30
 - data/spec/spec_helper.rb +0 -1
 - data/spec/support/dummy_class_for_tokens.rb +3 -0
 - metadata +9 -31
 
| 
         @@ -34,16 +34,21 @@ describe Auth0::Mixins::TokenManagement do 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
              context 'get_token' do
         
     | 
| 
       36 
36 
     | 
    
         
             
                it 'renews the token if there is no token set' do
         
     | 
| 
       37 
     | 
    
         
            -
                  expect(RestClient::Request).to receive(:execute) 
     | 
| 
       38 
     | 
    
         
            -
                     
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                     
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                     
     | 
| 
      
 37 
     | 
    
         
            +
                  expect(RestClient::Request).to receive(:execute) do |arg|
         
     | 
| 
      
 38 
     | 
    
         
            +
                    expect(arg).to(match(
         
     | 
| 
      
 39 
     | 
    
         
            +
                      include(
         
     | 
| 
      
 40 
     | 
    
         
            +
                        method: :post,
         
     | 
| 
      
 41 
     | 
    
         
            +
                        url: 'https://samples.auth0.com/oauth/token'
         
     | 
| 
      
 42 
     | 
    
         
            +
                    )))
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  
         
     | 
| 
      
 46 
     | 
    
         
            +
                    StubResponse.new({ 
         
     | 
| 
      
 47 
     | 
    
         
            +
                      "access_token" => "test", 
         
     | 
| 
      
 48 
     | 
    
         
            +
                      "expires_in" => 86400}, 
         
     | 
| 
      
 49 
     | 
    
         
            +
                      true, 
         
     | 
| 
      
 50 
     | 
    
         
            +
                      200)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
       47 
52 
     | 
    
         | 
| 
       48 
53 
     | 
    
         
             
                  instance.send(:get_token)
         
     | 
| 
       49 
54 
     | 
    
         | 
| 
         @@ -70,16 +75,21 @@ describe Auth0::Mixins::TokenManagement do 
     | 
|
| 
       70 
75 
     | 
    
         
             
                  params[:token] = 'test-token'
         
     | 
| 
       71 
76 
     | 
    
         
             
                  params[:token_expires_at] = time_now.to_i + 5
         
     | 
| 
       72 
77 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                  expect(RestClient::Request).to receive(:execute) 
     | 
| 
       74 
     | 
    
         
            -
                     
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                     
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                     
     | 
| 
      
 78 
     | 
    
         
            +
                  expect(RestClient::Request).to receive(:execute) do |arg|
         
     | 
| 
      
 79 
     | 
    
         
            +
                    expect(arg).to(match(
         
     | 
| 
      
 80 
     | 
    
         
            +
                      include(
         
     | 
| 
      
 81 
     | 
    
         
            +
                        method: :post,
         
     | 
| 
      
 82 
     | 
    
         
            +
                        url: 'https://samples.auth0.com/oauth/token'
         
     | 
| 
      
 83 
     | 
    
         
            +
                    )))
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                    expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  
         
     | 
| 
      
 87 
     | 
    
         
            +
                    StubResponse.new({ 
         
     | 
| 
      
 88 
     | 
    
         
            +
                      "access_token" => "renewed_token", 
         
     | 
| 
      
 89 
     | 
    
         
            +
                      "expires_in" => 86400}, 
         
     | 
| 
      
 90 
     | 
    
         
            +
                      true, 
         
     | 
| 
      
 91 
     | 
    
         
            +
                      200)
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
       83 
93 
     | 
    
         | 
| 
       84 
94 
     | 
    
         
             
                  instance.send(:get_token)
         
     | 
| 
       85 
95 
     | 
    
         | 
| 
         @@ -91,16 +101,21 @@ describe Auth0::Mixins::TokenManagement do 
     | 
|
| 
       91 
101 
     | 
    
         
             
                  params[:token] = 'test-token'
         
     | 
| 
       92 
102 
     | 
    
         
             
                  params[:token_expires_at] = time_now.to_i - 10
         
     | 
| 
       93 
103 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
                  expect(RestClient::Request).to receive(:execute) 
     | 
| 
       95 
     | 
    
         
            -
                     
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                     
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                     
     | 
| 
      
 104 
     | 
    
         
            +
                  expect(RestClient::Request).to receive(:execute) do |arg|
         
     | 
| 
      
 105 
     | 
    
         
            +
                    expect(arg).to(match(
         
     | 
| 
      
 106 
     | 
    
         
            +
                      include(
         
     | 
| 
      
 107 
     | 
    
         
            +
                        method: :post,
         
     | 
| 
      
 108 
     | 
    
         
            +
                        url: 'https://samples.auth0.com/oauth/token'
         
     | 
| 
      
 109 
     | 
    
         
            +
                    )))
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                    expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
         
     | 
| 
      
 112 
     | 
    
         
            +
                  
         
     | 
| 
      
 113 
     | 
    
         
            +
                    StubResponse.new({ 
         
     | 
| 
      
 114 
     | 
    
         
            +
                      "access_token" => "renewed_token", 
         
     | 
| 
      
 115 
     | 
    
         
            +
                      "expires_in" => 86400}, 
         
     | 
| 
      
 116 
     | 
    
         
            +
                      true, 
         
     | 
| 
      
 117 
     | 
    
         
            +
                      200)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  end
         
     | 
| 
       104 
119 
     | 
    
         | 
| 
       105 
120 
     | 
    
         
             
                  instance.send(:get_token)
         
     | 
| 
       106 
121 
     | 
    
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
| 
         @@ -13,5 +13,8 @@ class DummyClassForTokens 
     | 
|
| 
       13 
13 
     | 
    
         
             
                @base_uri = "https://#{@domain}"
         
     | 
| 
       14 
14 
     | 
    
         
             
                @token = config[:token]
         
     | 
| 
       15 
15 
     | 
    
         
             
                @token_expires_at = config[:token_expires_at]
         
     | 
| 
      
 16 
     | 
    
         
            +
                @client_assertion_signing_key = config[:client_assertion_signing_key]
         
     | 
| 
      
 17 
     | 
    
         
            +
                @client_assertion_signing_alg = config[:client_assertion_signing_alg] || 'RS256'
         
     | 
| 
      
 18 
     | 
    
         
            +
                @headers ||= {}
         
     | 
| 
       16 
19 
     | 
    
         
             
              end
         
     | 
| 
       17 
20 
     | 
    
         
             
            end
         
     | 
    
        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: 5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 5.13.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:  
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2023-04-24 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: rest-client
         
     | 
| 
         @@ -139,34 +139,6 @@ dependencies: 
     | 
|
| 
       139 
139 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       140 
140 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       141 
141 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
       142 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       143 
     | 
    
         
            -
              name: pry
         
     | 
| 
       144 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       145 
     | 
    
         
            -
                requirements:
         
     | 
| 
       146 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       147 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       148 
     | 
    
         
            -
                    version: '0.10'
         
     | 
| 
       149 
     | 
    
         
            -
              type: :development
         
     | 
| 
       150 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       151 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       152 
     | 
    
         
            -
                requirements:
         
     | 
| 
       153 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       154 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       155 
     | 
    
         
            -
                    version: '0.10'
         
     | 
| 
       156 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       157 
     | 
    
         
            -
              name: pry-nav
         
     | 
| 
       158 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       159 
     | 
    
         
            -
                requirements:
         
     | 
| 
       160 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       161 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       162 
     | 
    
         
            -
                    version: '0.2'
         
     | 
| 
       163 
     | 
    
         
            -
              type: :development
         
     | 
| 
       164 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       165 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       166 
     | 
    
         
            -
                requirements:
         
     | 
| 
       167 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       168 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       169 
     | 
    
         
            -
                    version: '0.2'
         
     | 
| 
       170 
142 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       171 
143 
     | 
    
         
             
              name: rspec
         
     | 
| 
       172 
144 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -276,11 +248,14 @@ files: 
     | 
|
| 
       276 
248 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       277 
249 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       278 
250 
     | 
    
         
             
            - ".rubocop_todo.yml"
         
     | 
| 
      
 251 
     | 
    
         
            +
            - ".semgrepignore"
         
     | 
| 
       279 
252 
     | 
    
         
             
            - ".shiprc"
         
     | 
| 
       280 
253 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       281 
254 
     | 
    
         
             
            - CODE_OF_CONDUCT.md
         
     | 
| 
       282 
255 
     | 
    
         
             
            - DEPLOYMENT.md
         
     | 
| 
      
 256 
     | 
    
         
            +
            - DEVELOPMENT.md
         
     | 
| 
       283 
257 
     | 
    
         
             
            - Dockerfile
         
     | 
| 
      
 258 
     | 
    
         
            +
            - EXAMPLES.md
         
     | 
| 
       284 
259 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       285 
260 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       286 
261 
     | 
    
         
             
            - Guardfile
         
     | 
| 
         @@ -389,6 +364,7 @@ files: 
     | 
|
| 
       389 
364 
     | 
    
         
             
            - lib/auth0/api/v2/users.rb
         
     | 
| 
       390 
365 
     | 
    
         
             
            - lib/auth0/api/v2/users_by_email.rb
         
     | 
| 
       391 
366 
     | 
    
         
             
            - lib/auth0/client.rb
         
     | 
| 
      
 367 
     | 
    
         
            +
            - lib/auth0/client_assertion.rb
         
     | 
| 
       392 
368 
     | 
    
         
             
            - lib/auth0/exception.rb
         
     | 
| 
       393 
369 
     | 
    
         
             
            - lib/auth0/mixins.rb
         
     | 
| 
       394 
370 
     | 
    
         
             
            - lib/auth0/mixins/access_token_struct.rb
         
     | 
| 
         @@ -401,6 +377,7 @@ files: 
     | 
|
| 
       401 
377 
     | 
    
         
             
            - lib/auth0/mixins/validation.rb
         
     | 
| 
       402 
378 
     | 
    
         
             
            - lib/auth0/version.rb
         
     | 
| 
       403 
379 
     | 
    
         
             
            - lib/auth0_client.rb
         
     | 
| 
      
 380 
     | 
    
         
            +
            - opslevel.yml
         
     | 
| 
       404 
381 
     | 
    
         
             
            - publish_rubygem.sh
         
     | 
| 
       405 
382 
     | 
    
         
             
            - spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml
         
     | 
| 
       406 
383 
     | 
    
         
             
            - spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml
         
     | 
| 
         @@ -579,6 +556,7 @@ files: 
     | 
|
| 
       579 
556 
     | 
    
         
             
            - spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb
         
     | 
| 
       580 
557 
     | 
    
         
             
            - spec/integration/lib/auth0/api/v2/api_users_spec.rb
         
     | 
| 
       581 
558 
     | 
    
         
             
            - spec/integration/lib/auth0/auth0_client_spec.rb
         
     | 
| 
      
 559 
     | 
    
         
            +
            - spec/lib/auth0/api/authentication_endpoints_spec.rb
         
     | 
| 
       582 
560 
     | 
    
         
             
            - spec/lib/auth0/api/v2/actions_spec.rb
         
     | 
| 
       583 
561 
     | 
    
         
             
            - spec/lib/auth0/api/v2/anomaly_spec.rb
         
     | 
| 
       584 
562 
     | 
    
         
             
            - spec/lib/auth0/api/v2/attack_protection_spec.rb
         
     | 
| 
         @@ -637,7 +615,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       637 
615 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       638 
616 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       639 
617 
     | 
    
         
             
            requirements: []
         
     | 
| 
       640 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 618 
     | 
    
         
            +
            rubygems_version: 3.4.10
         
     | 
| 
       641 
619 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       642 
620 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       643 
621 
     | 
    
         
             
            summary: Auth0 API Client
         
     |