net-http-digest_auth 1.1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +5 -0
- data/lib/net/http/digest_auth.rb +15 -5
- data/test/test_net_http_digest_auth.rb +6 -0
- metadata +13 -18
- metadata.gz.sig +3 -2
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/net/http/digest_auth.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'digest'
|
3
1
|
require 'cgi'
|
2
|
+
require 'digest'
|
3
|
+
require 'net/http'
|
4
|
+
require 'monitor'
|
4
5
|
|
5
6
|
##
|
6
7
|
# An implementation of RFC 2617 Digest Access Authentication.
|
@@ -33,6 +34,8 @@ require 'cgi'
|
|
33
34
|
|
34
35
|
class Net::HTTP::DigestAuth
|
35
36
|
|
37
|
+
include MonitorMixin
|
38
|
+
|
36
39
|
##
|
37
40
|
# DigestAuth error class
|
38
41
|
|
@@ -41,7 +44,7 @@ class Net::HTTP::DigestAuth
|
|
41
44
|
##
|
42
45
|
# Version of Net::HTTP::DigestAuth you are using
|
43
46
|
|
44
|
-
VERSION = '1.
|
47
|
+
VERSION = '1.2'
|
45
48
|
|
46
49
|
##
|
47
50
|
# Creates a new DigestAuth header creator.
|
@@ -50,6 +53,7 @@ class Net::HTTP::DigestAuth
|
|
50
53
|
# secret value.
|
51
54
|
|
52
55
|
def initialize cnonce = make_cnonce
|
56
|
+
mon_initialize
|
53
57
|
@nonce_count = -1
|
54
58
|
@cnonce = cnonce
|
55
59
|
end
|
@@ -69,7 +73,7 @@ class Net::HTTP::DigestAuth
|
|
69
73
|
# differently so you may need to set +iis+ to true for such servers.
|
70
74
|
|
71
75
|
def auth_header uri, www_authenticate, method, iis = false
|
72
|
-
|
76
|
+
nonce_count = next_nonce
|
73
77
|
|
74
78
|
user = CGI.unescape uri.user
|
75
79
|
password = CGI.unescape uri.password
|
@@ -111,7 +115,7 @@ class Net::HTTP::DigestAuth
|
|
111
115
|
ha2 = algorithm.hexdigest "#{method}:#{uri.request_uri}"
|
112
116
|
|
113
117
|
request_digest = [ha1, params['nonce']]
|
114
|
-
request_digest.push(('%08x' %
|
118
|
+
request_digest.push(('%08x' % nonce_count), @cnonce, qop) if qop
|
115
119
|
request_digest << ha2
|
116
120
|
request_digest = request_digest.join ':'
|
117
121
|
|
@@ -145,5 +149,11 @@ class Net::HTTP::DigestAuth
|
|
145
149
|
Digest::MD5.hexdigest "%x" % (Time.now.to_i + rand(65535))
|
146
150
|
end
|
147
151
|
|
152
|
+
def next_nonce
|
153
|
+
synchronize do
|
154
|
+
@nonce_count += 1
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
148
158
|
end
|
149
159
|
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http-digest_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 1.1.1
|
8
|
+
- 2
|
9
|
+
version: "1.2"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Eric Hodel
|
@@ -36,8 +35,7 @@ cert_chain:
|
|
36
35
|
x52qPcexcYZR7w==
|
37
36
|
-----END CERTIFICATE-----
|
38
37
|
|
39
|
-
date: 2011-
|
40
|
-
default_executable:
|
38
|
+
date: 2011-11-23 00:00:00 Z
|
41
39
|
dependencies:
|
42
40
|
- !ruby/object:Gem::Dependency
|
43
41
|
name: minitest
|
@@ -45,14 +43,13 @@ dependencies:
|
|
45
43
|
requirement: &id001 !ruby/object:Gem::Requirement
|
46
44
|
none: false
|
47
45
|
requirements:
|
48
|
-
- -
|
46
|
+
- - ~>
|
49
47
|
- !ruby/object:Gem::Version
|
50
|
-
hash:
|
48
|
+
hash: 15
|
51
49
|
segments:
|
52
50
|
- 2
|
53
|
-
-
|
54
|
-
|
55
|
-
version: 2.0.2
|
51
|
+
- 6
|
52
|
+
version: "2.6"
|
56
53
|
type: :development
|
57
54
|
version_requirements: *id001
|
58
55
|
- !ruby/object:Gem::Dependency
|
@@ -61,14 +58,13 @@ dependencies:
|
|
61
58
|
requirement: &id002 !ruby/object:Gem::Requirement
|
62
59
|
none: false
|
63
60
|
requirements:
|
64
|
-
- -
|
61
|
+
- - ~>
|
65
62
|
- !ruby/object:Gem::Version
|
66
|
-
hash:
|
63
|
+
hash: 27
|
67
64
|
segments:
|
68
65
|
- 2
|
69
|
-
-
|
70
|
-
|
71
|
-
version: 2.9.4
|
66
|
+
- 12
|
67
|
+
version: "2.12"
|
72
68
|
type: :development
|
73
69
|
version_requirements: *id002
|
74
70
|
description: |-
|
@@ -96,7 +92,6 @@ files:
|
|
96
92
|
- sample/net_http_example.rb
|
97
93
|
- test/test_net_http_digest_auth.rb
|
98
94
|
- .gemtest
|
99
|
-
has_rdoc: true
|
100
95
|
homepage: http://docs.seattlerb.org/net-http-digest_auth
|
101
96
|
licenses: []
|
102
97
|
|
@@ -127,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
122
|
requirements: []
|
128
123
|
|
129
124
|
rubyforge_project: seattlerb
|
130
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.8.10
|
131
126
|
signing_key:
|
132
127
|
specification_version: 3
|
133
128
|
summary: An implementation of RFC 2617 - Digest Access Authentication
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
i�7��'���j�;�J ����hfA�{�M��'�xh�x�^M c+���Z_˗'�X�.����ї�
|
2
|
+
{����/ojt[�2C���N����gg7�#�tȩ�O�_�V�f���y�K�Mn���Jt}_�.���i}/�Q㏿<
|
3
|
+
���z���A75�c_���*���W��Ƀ��������DnʕD�Z_C�M�q�tՋ'3��X���]EV�7������ANk��r��v�c��!~1�xxP
|