faraday-digestauth 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -72
- data/.rubocop_todo.yml +19 -9
- data/.travis.yml +2 -29
- data/Gemfile +2 -0
- data/README.md +17 -16
- data/Rakefile +2 -0
- data/faraday-digestauth.gemspec +7 -7
- data/lib/faraday/digestauth.rb +2 -1
- data/lib/faraday/digestauth/connection.rb +3 -2
- data/lib/faraday/digestauth/version.rb +3 -2
- data/lib/faraday/request/digestauth.rb +5 -2
- data/spec/faraday/request/digest_auth_spec.rb +4 -2
- data/spec/spec_helper.rb +2 -0
- metadata +25 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fae90225b1244044f5a19527d52282d07f9b2e3b2177988ca8a310ca7af591d
|
4
|
+
data.tar.gz: 6ce7e931a6e1265230a404b0c1bab47524e7a7593ddde9cc8d8d30eb48303d1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e040769bed84be9c5f81824e9967abe9b2ac86698d5ffc86a024e45e25336c729799d3d50a3ec59a8bad828d9acd65f62cf27c885281eb91749dba124f1566a
|
7
|
+
data.tar.gz: af6e645dbab964be5e37b374488395522768682f16d611b3dfb003c00c5c4497c5669a747f278b0c45381718519ee1065165a633f3241b228a8ea1c621ff8495
|
data/.rubocop.yml
CHANGED
@@ -5,76 +5,4 @@ AllCops:
|
|
5
5
|
- vendor/**/*
|
6
6
|
- bin/**/*
|
7
7
|
|
8
|
-
LineLength:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
MethodLength:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
ClassLength:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Documentation:
|
18
|
-
# don't require classes to be documented
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
CollectionMethods:
|
22
|
-
# don't prefer map to collect, recuce to inject
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Encoding:
|
26
|
-
# no need to always specify encoding
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
StringLiterals:
|
30
|
-
# use single or double-quoted strings, as you please
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
Void:
|
34
|
-
# == operator used in void context in specs
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
SignalException:
|
38
|
-
# prefer raise to fail
|
39
|
-
EnforcedStyle: only_raise
|
40
|
-
|
41
|
-
RaiseArgs:
|
42
|
-
# don't care for what kind of raise
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
PerlBackrefs:
|
46
|
-
# TODO: regular expression matching with $1, $2, etc.
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
BlockNesting:
|
50
|
-
# TODO: fix too much nesting
|
51
|
-
Max: 4
|
52
|
-
|
53
|
-
Style/BlockLength:
|
54
|
-
Exclude:
|
55
|
-
- 'Rakefile'
|
56
|
-
- '**/*.rake'
|
57
|
-
- 'spec/**/*.rb'
|
58
|
-
|
59
|
-
Lambda:
|
60
|
-
# TODO: replace all lambda with -> or Proc
|
61
|
-
Enabled: false
|
62
|
-
|
63
|
-
Blocks:
|
64
|
-
# allow multi-line blocks like expect { }
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
WordArray:
|
68
|
-
# %w vs. [ '', ... ]
|
69
|
-
Enabled: false
|
70
|
-
|
71
|
-
CyclomaticComplexity:
|
72
|
-
Enabled: false
|
73
|
-
|
74
|
-
DoubleNegation:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
PredicateName:
|
78
|
-
Enabled: false
|
79
|
-
|
80
8
|
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,26 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
#
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-05-10 19:28:00 -0400 using RuboCop version 0.82.0.
|
3
4
|
# The point is for the user to remove these configuration records
|
4
5
|
# one by one as the offenses are removed from the code base.
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
6
7
|
# versions of RuboCop, may require this file to be generated again.
|
7
8
|
|
8
9
|
# Offense count: 1
|
9
|
-
# Configuration parameters:
|
10
|
-
|
11
|
-
|
10
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
11
|
+
# ExcludedMethods: refine
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 47
|
12
14
|
|
13
|
-
# Offense count:
|
14
|
-
#
|
15
|
-
Style/
|
16
|
-
|
15
|
+
# Offense count: 1
|
16
|
+
# Cop supports --auto-correct.
|
17
|
+
Style/IfUnlessModifier:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/faraday/request/digestauth.rb'
|
20
|
+
|
21
|
+
# Offense count: 5
|
22
|
+
# Cop supports --auto-correct.
|
23
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
24
|
+
# URISchemes: http, https
|
25
|
+
Layout/LineLength:
|
26
|
+
Max: 99
|
data/.travis.yml
CHANGED
@@ -1,31 +1,4 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
- gem update --system
|
4
|
-
- gem update bundler
|
5
|
-
env:
|
6
|
-
global:
|
7
|
-
- "JRUBY_OPTS=-Xcext.enabled=true"
|
2
|
+
|
8
3
|
rvm:
|
9
|
-
-
|
10
|
-
- 1.9.2
|
11
|
-
- 1.9.3
|
12
|
-
- 2.0.0
|
13
|
-
- 2.1.0
|
14
|
-
- 2.2.0
|
15
|
-
- 2.3.0
|
16
|
-
- jruby-18mode
|
17
|
-
- jruby-19mode
|
18
|
-
- ruby-head
|
19
|
-
- jruby-head
|
20
|
-
- ree
|
21
|
-
matrix:
|
22
|
-
allow_failures:
|
23
|
-
- rvm: 1.8.7
|
24
|
-
- rvm: 1.9.2
|
25
|
-
- rvm: 1.9.3
|
26
|
-
- rvm: ree
|
27
|
-
- rvm: jruby-18mode
|
28
|
-
- rvm: jruby-19mode
|
29
|
-
- rvm: jruby-head
|
30
|
-
- rvm: ruby-head
|
31
|
-
fast_finish: true
|
4
|
+
- 2.6.6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
# Faraday::DigestAuth
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/faraday-digestauth.
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![Code Climate](https://codeclimate.com/github/bhaberer/faraday-digestauth.png)](https://codeclimate.com/github/bhaberer/faraday-digestauth)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/faraday-digestauth.svg)](https://badge.fury.io/rb/faraday-digestauth)
|
4
|
+
[![Build Status](https://travis-ci.org/bhaberer/faraday-digestauth.svg?branch=master)](https://travis-ci.org/bhaberer/faraday-digestauth)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/bhaberer/faraday-digestauth/badge.svg?branch=master)](https://coveralls.io/r/bhaberer/faraday-digestauth?branch=master)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/bhaberer/faraday-digestauth.svg)](https://codeclimate.com/github/bhaberer/faraday-digestauth)
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
11
10
|
Add this line to your application's Gemfile:
|
12
11
|
|
13
|
-
|
12
|
+
```ruby
|
13
|
+
gem 'faraday-digestauth'
|
14
|
+
```
|
14
15
|
|
15
16
|
And then execute:
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$ gem install faraday-digestauth
|
18
|
+
```
|
19
|
+
$ bundle install
|
20
|
+
```
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
```
|
24
|
+
```ruby
|
26
25
|
require 'faraday'
|
27
26
|
require 'faraday/digestauth'
|
28
27
|
|
29
|
-
|
28
|
+
conn = Faraday.new(url: HOSTNAME) do |f|
|
30
29
|
f.request :digest, USERNAME, PASSWORD
|
31
|
-
f.adapter
|
30
|
+
f.adapter Faraday.default_adapter
|
32
31
|
end
|
33
32
|
|
34
|
-
|
33
|
+
conn.get 'resource'
|
35
34
|
```
|
36
35
|
|
37
36
|
## Contributing
|
@@ -44,7 +43,9 @@ end
|
|
44
43
|
|
45
44
|
## History
|
46
45
|
|
47
|
-
This gem was extracted from [Hyperclient](https://github.com/codegram/hyperclient) by [@oriolgual](https://github.com/oriolgual).
|
46
|
+
This gem was extracted from [Hyperclient](https://github.com/codegram/hyperclient) by [@oriolgual](https://github.com/oriolgual) and turned into a gem by [@bhaberer](https://github.com/bhaberer).
|
47
|
+
|
48
|
+
Note: I'm not actively maintaining or managing this gem any longer, as I no longer work on projects using digest auth, if you would like to help maintain this gem please let me know.
|
48
49
|
|
49
50
|
## License
|
50
51
|
|
data/Rakefile
CHANGED
data/faraday-digestauth.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'faraday/digestauth/version'
|
6
6
|
|
@@ -19,12 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'faraday', '
|
22
|
+
spec.add_dependency 'faraday', '>= 0.7'
|
23
23
|
spec.add_dependency 'net-http-digest_auth', '~> 1.4'
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
24
|
spec.add_development_dependency 'coveralls', '~> 0.1'
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
27
26
|
spec.add_development_dependency 'rspec', '~> 3'
|
28
|
-
spec.add_development_dependency 'rubocop
|
29
|
-
spec.add_development_dependency '
|
27
|
+
spec.add_development_dependency 'rubocop', '0.82.0'
|
28
|
+
spec.add_development_dependency 'rubocop-rspec', '1.39.0'
|
29
|
+
spec.add_development_dependency 'webmock', '~> 3.8.3'
|
30
30
|
end
|
data/lib/faraday/digestauth.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Faraday
|
3
4
|
module DigestAuth
|
4
5
|
# Connection methods
|
@@ -16,4 +17,4 @@ module Faraday
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
Faraday::Connection.
|
20
|
+
Faraday::Connection.include Faraday::DigestAuth::Connection
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Faraday
|
3
4
|
class Request
|
4
5
|
# Public: A Faraday middleware to use digest authentication. Since order of
|
@@ -46,7 +47,9 @@ module Faraday
|
|
46
47
|
def call(env)
|
47
48
|
response = handshake(env)
|
48
49
|
return response unless response.status == 401
|
49
|
-
|
50
|
+
unless response.headers['www-authenticate'] =~ /Digest +[^\s]+/
|
51
|
+
return response
|
52
|
+
end
|
50
53
|
|
51
54
|
env[:request_headers]['Authorization'] = header(response)
|
52
55
|
@app.call(env)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
context Faraday::Request::DigestAuth do
|
@@ -43,8 +45,8 @@ context Faraday::Request::DigestAuth do
|
|
43
45
|
.with(body: nil)
|
44
46
|
.to_return(status: 401, headers: { 'www-authenticate' => first_call_headers })
|
45
47
|
stub_request(:get, 'http://api.example.org/productions/1')
|
46
|
-
.with(body:
|
47
|
-
headers: { 'Authorization' =>
|
48
|
+
.with(body: '{"foo":1}',
|
49
|
+
headers: { 'Authorization' => /second_call_headers/ })
|
48
50
|
.to_return(body: '{"resource": "This is the resource"}',
|
49
51
|
headers: { content_type: 'application/json' })
|
50
52
|
connection.get('/productions/1')
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-digestauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Haberer
|
@@ -9,20 +9,20 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0.7'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.7'
|
28
28
|
- !ruby/object:Gem::Dependency
|
@@ -40,89 +40,89 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.4'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: coveralls
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '1
|
48
|
+
version: '0.1'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '1
|
55
|
+
version: '0.1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 12.3.3
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 12.3.3
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
71
|
+
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '3'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '3'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: rubocop
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 0.82.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 0.82.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rubocop-rspec
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: 1.39.0
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: 1.39.0
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: webmock
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: 3.8.3
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: 3.8.3
|
126
126
|
description: Faraday extension to enable digest auth
|
127
127
|
email:
|
128
128
|
- bhaberer@gmail.com
|
@@ -166,8 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
|
170
|
-
rubygems_version: 2.7.3
|
169
|
+
rubygems_version: 3.0.4
|
171
170
|
signing_key:
|
172
171
|
specification_version: 4
|
173
172
|
summary: Digest Auth for Faraday
|