htauth 2.2.0 → 3.0.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +21 -1
  3. data/Manifest.txt +5 -27
  4. data/README.md +51 -31
  5. data/exe/htdigest-ruby +14 -0
  6. data/exe/htpasswd-ruby +14 -0
  7. data/htauth.gemspec +33 -0
  8. data/lib/htauth/algorithm.rb +42 -29
  9. data/lib/htauth/argon2.rb +86 -0
  10. data/lib/htauth/bcrypt.rb +17 -11
  11. data/lib/htauth/cli/digest.rb +42 -49
  12. data/lib/htauth/cli/passwd.rb +127 -114
  13. data/lib/htauth/cli.rb +5 -4
  14. data/lib/htauth/console.rb +9 -6
  15. data/lib/htauth/crypt.rb +11 -9
  16. data/lib/htauth/descendant_tracker.rb +11 -9
  17. data/lib/htauth/digest_entry.rb +22 -19
  18. data/lib/htauth/digest_file.rb +25 -18
  19. data/lib/htauth/entry.rb +3 -1
  20. data/lib/htauth/error.rb +6 -5
  21. data/lib/htauth/file.rb +35 -39
  22. data/lib/htauth/md5.rb +35 -34
  23. data/lib/htauth/passwd_entry.rb +29 -38
  24. data/lib/htauth/passwd_file.rb +32 -27
  25. data/lib/htauth/plaintext.rb +7 -5
  26. data/lib/htauth/sha1.rb +9 -7
  27. data/lib/htauth/version.rb +3 -1
  28. data/lib/htauth.rb +29 -28
  29. metadata +24 -113
  30. data/Rakefile +0 -27
  31. data/bin/htdigest-ruby +0 -12
  32. data/bin/htpasswd-ruby +0 -12
  33. data/spec/algorithm_spec.rb +0 -8
  34. data/spec/bcrypt_spec.rb +0 -33
  35. data/spec/cli/digest_spec.rb +0 -149
  36. data/spec/cli/passwd_spec.rb +0 -330
  37. data/spec/crypt_spec.rb +0 -12
  38. data/spec/digest_entry_spec.rb +0 -60
  39. data/spec/digest_file_spec.rb +0 -65
  40. data/spec/md5_spec.rb +0 -13
  41. data/spec/passwd_entry_spec.rb +0 -159
  42. data/spec/passwd_file_spec.rb +0 -84
  43. data/spec/plaintext_spec.rb +0 -11
  44. data/spec/sha1_spec.rb +0 -11
  45. data/spec/spec_helper.rb +0 -28
  46. data/spec/test.add.digest +0 -3
  47. data/spec/test.add.passwd +0 -3
  48. data/spec/test.delete.digest +0 -1
  49. data/spec/test.delete.passwd +0 -1
  50. data/spec/test.original.digest +0 -2
  51. data/spec/test.original.passwd +0 -2
  52. data/spec/test.update.digest +0 -2
  53. data/spec/test.update.passwd +0 -2
  54. data/tasks/default.rake +0 -242
  55. data/tasks/this.rb +0 -208
  56. /data/{LICENSE → LICENSE.txt} +0 -0
@@ -1,9 +1,11 @@
1
- require 'stringio'
2
- require 'tempfile'
1
+ # frozen_string_literal: true
3
2
 
4
- require 'htauth/error'
5
- require 'htauth/file'
6
- require 'htauth/passwd_entry'
3
+ require "stringio"
4
+ require "tempfile"
5
+
6
+ require "htauth/error"
7
+ require "htauth/file"
8
+ require "htauth/passwd_entry"
7
9
 
8
10
  module HTAuth
9
11
  # Public: An API for managing an 'htpasswd' file
@@ -11,13 +13,12 @@ module HTAuth
11
13
  # Examples
12
14
  #
13
15
  # ::HTAuth::PasswdFile.open("my.passwd") do |pf|
14
- # pf.has_entry?('myuser', 'myrealm')
15
- # pf.add_or_update('someuser', 'myrealm', 'a password')
16
- # pf.delete('someolduser', 'myotherrealm')
16
+ # pf.has_entry?('myuser')
17
+ # pf.add_or_update('someuser', 'a password')
18
+ # pf.delete('someolduser')
17
19
  # end
18
20
  #
19
21
  class PasswdFile < HTAuth::File
20
-
21
22
  # Private: The class implementing a single entry in the PasswdFile
22
23
  ENTRY_KLASS = HTAuth::PasswdEntry
23
24
 
@@ -33,7 +34,7 @@ module HTAuth
33
34
  # Returns true or false if the username
34
35
  def has_entry?(username)
35
36
  test_entry = PasswdEntry.new(username)
36
- @entries.has_key?(test_entry.key)
37
+ @entries.key?(test_entry.key)
37
38
  end
38
39
 
39
40
  # Public: remove the given username from the file
@@ -48,10 +49,10 @@ module HTAuth
48
49
  #
49
50
  # Returns nothing
50
51
  def delete(username)
51
- if has_entry?(username) then
52
+ if has_entry?(username)
52
53
  ir = internal_record(username)
53
- line_index = ir['line_index']
54
- @entries.delete(ir['entry'].key)
54
+ line_index = ir["line_index"]
55
+ @entries.delete(ir["entry"].key)
55
56
  @lines[line_index] = nil
56
57
  dirty!
57
58
  end
@@ -59,7 +60,7 @@ module HTAuth
59
60
  end
60
61
 
61
62
  # Public: Add or update the username entry with the new password and
62
- # algorithm. This will add a new entry if the username does not exist in
63
+ # algorithm. This will add a new entry if the username does not exist in
63
64
  # the file. If the entry does exist in the file, then the password
64
65
  # of the entry is updated to the new password / algorithm
65
66
  #
@@ -68,7 +69,7 @@ module HTAuth
68
69
  # username - the username of the entry
69
70
  # password - the password of the entry
70
71
  # algorithm - the algorithm to use (default: "md5"). Valid options are:
71
- # "md5", "bcrypt", "sha1", "plaintext", or "crypt"
72
+ # "md5", "bcrypt", "argon2", "sha1", "plaintext", or "crypt"
72
73
  # algorithm_args - key-value pairs of arguments that are passed to the
73
74
  # algorithm, currently this is only used to pass the cost
74
75
  # to the bcrypt algorithm
@@ -84,7 +85,7 @@ module HTAuth
84
85
  #
85
86
  # Returns nothing.
86
87
  def add_or_update(username, password, algorithm = Algorithm::DEFAULT, algorithm_args = {})
87
- if has_entry?(username) then
88
+ if has_entry?(username)
88
89
  update(username, password, algorithm, algorithm_args)
89
90
  else
90
91
  add(username, password, algorithm, algorithm_args)
@@ -96,7 +97,7 @@ module HTAuth
96
97
  # username - the username of the entry
97
98
  # password - the password of the entry
98
99
  # algorithm - the algorithm to use (default: "md5"). Valid options are:
99
- # "md5", "bcrypt", "sha1", "plaintext", or "crypt"
100
+ # "md5", "bcrypt", "argon2", "sha1", "plaintext", or "crypt"
100
101
  # algorithm_args - key-value pairs of arguments that are passed to the
101
102
  # algorithm, currently this is only used to pass the cost
102
103
  # to the bcrypt algorithm
@@ -116,12 +117,13 @@ module HTAuth
116
117
  # Raises PasswdFileError if the give username already exists.
117
118
  def add(username, password, algorithm = Algorithm::DEFAULT, algorithm_args = {})
118
119
  raise PasswdFileError, "Unable to add already existing user #{username}" if has_entry?(username)
120
+
119
121
  new_entry = PasswdEntry.new(username, password, algorithm, algorithm_args)
120
122
  new_index = @lines.size
121
123
  @lines << new_entry.to_s
122
- @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }
124
+ @entries[new_entry.key] = { "entry" => new_entry, "line_index" => new_index }
123
125
  dirty!
124
- return nil
126
+ nil
125
127
  end
126
128
 
127
129
  # Public: Update an existing record in the file.
@@ -133,7 +135,7 @@ module HTAuth
133
135
  # username - the username of the entry
134
136
  # password - the password of the entry
135
137
  # algorithm - the algorithm to use (default: "existing"). Valid options are:
136
- # "existing", "md5", "bcrypt", "sha1", "plaintext", or "crypt"
138
+ # "existing", "md5", "bcrypt", "argon2", "sha1", "plaintext", or "crypt"
137
139
  # algorithm_args - key-value pairs of arguments that are passed to the
138
140
  # algorithm, currently this is only used to pass the cost
139
141
  # to the bcrypt algorithm
@@ -153,13 +155,14 @@ module HTAuth
153
155
  # Raises PasswdFileError if the give username does not exist.
154
156
  def update(username, password, algorithm = Algorithm::EXISTING, algorithm_args = {})
155
157
  raise PasswdFileError, "Unable to update non-existent user #{username}" unless has_entry?(username)
158
+
156
159
  ir = internal_record(username)
157
- ir['entry'].algorithm = algorithm
158
- ir['entry'].algorithm_args = algorithm_args.dup
159
- ir['entry'].password = password
160
- @lines[ir['line_index']] = ir['entry'].to_s
160
+ ir["entry"].algorithm = algorithm
161
+ ir["entry"].algorithm_args = algorithm_args.dup
162
+ ir["entry"].password = password
163
+ @lines[ir["line_index"]] = ir["entry"].to_s
161
164
  dirty!
162
- return nil
165
+ nil
163
166
  end
164
167
 
165
168
  # Public: Returns a copy of then given PasswdEntry from the file.
@@ -177,8 +180,9 @@ module HTAuth
177
180
  # Returns nil if the entry is not found
178
181
  def fetch(username)
179
182
  return nil unless has_entry?(username)
183
+
180
184
  ir = internal_record(username)
181
- return ir['entry'].dup
185
+ ir["entry"].dup
182
186
  end
183
187
 
184
188
  # Public: authenticates the password of a given username
@@ -194,8 +198,9 @@ module HTAuth
194
198
  # Raises PasswordFileErrorif the given username does not exist
195
199
  def authenticated?(username, password)
196
200
  raise PasswdFileError, "Unable to authenticate a non-existent user #{username}" unless has_entry?(username)
201
+
197
202
  ir = internal_record(username)
198
- return ir['entry'].authenticated?(password)
203
+ ir["entry"].authenticated?(password)
199
204
  end
200
205
 
201
206
  # Internal: returns the class used for each entry
@@ -1,25 +1,27 @@
1
- require 'htauth/algorithm'
1
+ # frozen_string_literal: true
2
+
3
+ require "htauth/algorithm"
2
4
 
3
5
  module HTAuth
4
6
  # Internal: the plaintext algorithm, which does absolutly nothing
5
7
  class Plaintext < Algorithm
6
-
7
8
  ENTRY_REGEX = /\A[^$:]*\Z/
8
9
 
9
10
  def self.entry_matches?(entry)
10
11
  ENTRY_REGEX.match?(entry)
11
12
  end
12
13
 
13
- def self.handles?(password_entry)
14
+ def self.handles?(_password_entry)
14
15
  false
15
16
  end
16
17
 
17
18
  # ignore parameters
18
- def initialize(params = {})
19
+ def initialize(_params = {})
20
+ super()
19
21
  end
20
22
 
21
23
  def encode(password)
22
- "#{password}"
24
+ password.to_s
23
25
  end
24
26
  end
25
27
  end
data/lib/htauth/sha1.rb CHANGED
@@ -1,22 +1,24 @@
1
- require 'htauth/algorithm'
2
- require 'digest/sha1'
3
- require 'base64'
1
+ # frozen_string_literal: true
2
+
3
+ require "htauth/algorithm"
4
+ require "digest/sha1"
5
+ require "base64"
4
6
 
5
7
  module HTAuth
6
8
  # Internal: an implementation of the SHA based encoding algorithm
7
9
  # as used in the apache htpasswd -s option
8
10
  #
9
11
  class Sha1 < Algorithm
10
-
11
- PREFIX = '{SHA}'.freeze
12
- ENTRY_REGEX = %r[\A#{Regexp.escape(PREFIX)}[A-Za-z0-9+\/=]{28}\z].freeze
12
+ PREFIX = "{SHA}"
13
+ ENTRY_REGEX = %r[\A#{Regexp.escape(PREFIX)}[A-Za-z0-9+/=]{28}\z]
13
14
 
14
15
  def self.handles?(password_entry)
15
16
  ENTRY_REGEX.match?(password_entry)
16
17
  end
17
18
 
18
19
  # ignore the params
19
- def initialize(params = {})
20
+ def initialize(_params = {})
21
+ super()
20
22
  end
21
23
 
22
24
  def encode(password)
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HTAuth
2
4
  # Public: The version of the htauth library
3
- VERSION = "2.2.0"
5
+ VERSION = "3.0.0"
4
6
  end
data/lib/htauth.rb CHANGED
@@ -1,46 +1,47 @@
1
- #--
1
+ # frozen_string_literal: true
2
+
3
+ #--
2
4
  # Copyrigth (c) 2008 Jeremy Hinegardner
3
5
  # All rights reserved. See LICENSE and/or COPYING for details
4
6
  #++
5
7
 
8
+ # Public: module wrapper for library
9
+ #
6
10
  module HTAuth
7
-
8
11
  # The root directory of the project is considered to be the parent directory
9
12
  # of the 'lib' directory.
10
13
  #
11
14
  def self.root_dir
12
15
  unless @root_dir
13
- path_parts = ::File.expand_path( __FILE__ ).split( ::File::SEPARATOR )
14
- lib_index = path_parts.rindex( 'lib' )
15
- @root_dir = path_parts[ 0...lib_index].join( ::File::SEPARATOR ) + ::File::SEPARATOR
16
+ path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
17
+ lib_index = path_parts.rindex("lib")
18
+ @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
16
19
  end
17
- return @root_dir
20
+ @root_dir
18
21
  end
19
22
 
20
- def self.lib_path( *args )
21
- self.sub_path( "lib", *args )
23
+ def self.lib_path(*args)
24
+ sub_path("lib", *args)
22
25
  end
23
26
 
24
- def self.sub_path( sub, *args )
25
- sp = ::File.join( root_dir, sub ) + ::File::SEPARATOR
26
- sp = ::File.join( sp, *args ) if args
27
+ def self.sub_path(sub, *args)
28
+ sp = ::File.join(root_dir, sub) + ::File::SEPARATOR
29
+ ::File.join(sp, *args) if args
27
30
  end
28
-
29
31
  end
30
32
 
31
- require 'htauth/version'
32
- require 'htauth/algorithm'
33
- require 'htauth/console'
34
- require 'htauth/bcrypt'
35
- require 'htauth/crypt'
36
- require 'htauth/digest_entry'
37
- require 'htauth/digest_file'
38
- require 'htauth/entry'
39
- require 'htauth/error'
40
- require 'htauth/file'
41
- require 'htauth/md5'
42
- require 'htauth/passwd_entry'
43
- require 'htauth/passwd_file'
44
- require 'htauth/plaintext'
45
- require 'htauth/sha1'
46
-
33
+ require "htauth/version"
34
+ require "htauth/algorithm"
35
+ require "htauth/argon2"
36
+ require "htauth/bcrypt"
37
+ require "htauth/crypt"
38
+ require "htauth/digest_entry"
39
+ require "htauth/digest_file"
40
+ require "htauth/entry"
41
+ require "htauth/error"
42
+ require "htauth/file"
43
+ require "htauth/md5"
44
+ require "htauth/passwd_entry"
45
+ require "htauth/passwd_file"
46
+ require "htauth/plaintext"
47
+ require "htauth/sha1"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
8
- autorequire:
9
- bindir: bin
8
+ bindir: exe
10
9
  cert_chain: []
11
- date: 2023-02-06 00:00:00.000000000 Z
10
+ date: 2026-05-23 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bcrypt
@@ -25,78 +24,35 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '3.1'
27
26
  - !ruby/object:Gem::Dependency
28
- name: rake
27
+ name: base64
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '13.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '13.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.11'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.11'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-junit
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rdoc
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '6.4'
76
- type: :development
32
+ version: '0.2'
33
+ type: :runtime
77
34
  prerelease: false
78
35
  version_requirements: !ruby/object:Gem::Requirement
79
36
  requirements:
80
37
  - - "~>"
81
38
  - !ruby/object:Gem::Version
82
- version: '6.4'
39
+ version: '0.2'
83
40
  - !ruby/object:Gem::Dependency
84
- name: simplecov
41
+ name: ostruct
85
42
  requirement: !ruby/object:Gem::Requirement
86
43
  requirements:
87
44
  - - "~>"
88
45
  - !ruby/object:Gem::Version
89
- version: '0.17'
90
- type: :development
46
+ version: '0.6'
47
+ type: :runtime
91
48
  prerelease: false
92
49
  version_requirements: !ruby/object:Gem::Requirement
93
50
  requirements:
94
51
  - - "~>"
95
52
  - !ruby/object:Gem::Version
96
- version: '0.17'
97
- description: HTAuth is a pure ruby replacement for the Apache support programs htdigest
98
- and htpasswd. Command line and API access are provided for access to htdigest and
99
- htpasswd files.
53
+ version: '0.6'
54
+ description: HTAuth provides an API and commandline tools for managing Apache/httpd
55
+ style htpasswd and htdigest files.
100
56
  email: jeremy@copiousfreetime.org
101
57
  executables:
102
58
  - htdigest-ruby
@@ -105,19 +61,21 @@ extensions: []
105
61
  extra_rdoc_files:
106
62
  - CONTRIBUTING.md
107
63
  - HISTORY.md
64
+ - LICENSE.txt
108
65
  - Manifest.txt
109
66
  - README.md
110
67
  files:
111
68
  - CONTRIBUTING.md
112
69
  - HISTORY.md
113
- - LICENSE
70
+ - LICENSE.txt
114
71
  - Manifest.txt
115
72
  - README.md
116
- - Rakefile
117
- - bin/htdigest-ruby
118
- - bin/htpasswd-ruby
73
+ - exe/htdigest-ruby
74
+ - exe/htpasswd-ruby
75
+ - htauth.gemspec
119
76
  - lib/htauth.rb
120
77
  - lib/htauth/algorithm.rb
78
+ - lib/htauth/argon2.rb
121
79
  - lib/htauth/bcrypt.rb
122
80
  - lib/htauth/cli.rb
123
81
  - lib/htauth/cli/digest.rb
@@ -136,29 +94,6 @@ files:
136
94
  - lib/htauth/plaintext.rb
137
95
  - lib/htauth/sha1.rb
138
96
  - lib/htauth/version.rb
139
- - spec/algorithm_spec.rb
140
- - spec/bcrypt_spec.rb
141
- - spec/cli/digest_spec.rb
142
- - spec/cli/passwd_spec.rb
143
- - spec/crypt_spec.rb
144
- - spec/digest_entry_spec.rb
145
- - spec/digest_file_spec.rb
146
- - spec/md5_spec.rb
147
- - spec/passwd_entry_spec.rb
148
- - spec/passwd_file_spec.rb
149
- - spec/plaintext_spec.rb
150
- - spec/sha1_spec.rb
151
- - spec/spec_helper.rb
152
- - spec/test.add.digest
153
- - spec/test.add.passwd
154
- - spec/test.delete.digest
155
- - spec/test.delete.passwd
156
- - spec/test.original.digest
157
- - spec/test.original.passwd
158
- - spec/test.update.digest
159
- - spec/test.update.passwd
160
- - tasks/default.rake
161
- - tasks/this.rb
162
97
  homepage: http://github.com/copiousfreetime/htauth
163
98
  licenses:
164
99
  - MIT
@@ -167,7 +102,6 @@ metadata:
167
102
  changelog_uri: https://github.com/copiousfreetime/htauth/blob/master/HISTORY.md
168
103
  homepage_uri: https://github.com/copiousfreetime/htauth
169
104
  source_code_uri: https://github.com/copiousfreetime/htauth
170
- post_install_message:
171
105
  rdoc_options:
172
106
  - "--main"
173
107
  - README.md
@@ -179,38 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
113
  requirements:
180
114
  - - ">="
181
115
  - !ruby/object:Gem::Version
182
- version: 2.3.0
116
+ version: 3.0.0
183
117
  required_rubygems_version: !ruby/object:Gem::Requirement
184
118
  requirements:
185
119
  - - ">="
186
120
  - !ruby/object:Gem::Version
187
121
  version: '0'
188
122
  requirements: []
189
- rubygems_version: 3.4.6
190
- signing_key:
123
+ rubygems_version: 4.0.10
191
124
  specification_version: 4
192
- summary: HTAuth is a pure ruby replacement for the Apache support programs htdigest
193
- and htpasswd. Command line and API access are provided for access to htdigest and
194
- htpasswd files.
195
- test_files:
196
- - spec/algorithm_spec.rb
197
- - spec/bcrypt_spec.rb
198
- - spec/cli/digest_spec.rb
199
- - spec/cli/passwd_spec.rb
200
- - spec/crypt_spec.rb
201
- - spec/digest_entry_spec.rb
202
- - spec/digest_file_spec.rb
203
- - spec/md5_spec.rb
204
- - spec/passwd_entry_spec.rb
205
- - spec/passwd_file_spec.rb
206
- - spec/plaintext_spec.rb
207
- - spec/sha1_spec.rb
208
- - spec/spec_helper.rb
209
- - spec/test.add.digest
210
- - spec/test.add.passwd
211
- - spec/test.delete.digest
212
- - spec/test.delete.passwd
213
- - spec/test.original.digest
214
- - spec/test.original.passwd
215
- - spec/test.update.digest
216
- - spec/test.update.passwd
125
+ summary: HTAuth provides an API and commandline tools for managing Apache/httpd style
126
+ htpasswd and htdigest files.
127
+ test_files: []
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- # vim: syntax=ruby
2
- load 'tasks/this.rb'
3
-
4
- This.name = "htauth"
5
- This.author = "Jeremy Hinegardner"
6
- This.email = "jeremy@copiousfreetime.org"
7
- This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
8
-
9
- This.ruby_gemspec do |spec|
10
- spec.add_dependency( 'bcrypt', '~> 3.1' )
11
-
12
- spec.add_development_dependency( 'rake' , '~> 13.0')
13
- spec.add_development_dependency( 'minitest' , '~> 5.11' )
14
- spec.add_development_dependency( 'minitest-junit' , '~> 1.0' )
15
- spec.add_development_dependency( 'rdoc' , '~> 6.4' )
16
- spec.add_development_dependency( 'simplecov', '~> 0.17' )
17
-
18
- spec.metadata = {
19
- "bug_tracker_uri" => "https://github.com/copiousfreetime/htauth/issues",
20
- "changelog_uri" => "https://github.com/copiousfreetime/htauth/blob/master/HISTORY.md",
21
- "homepage_uri" => "https://github.com/copiousfreetime/htauth",
22
- "source_code_uri" => "https://github.com/copiousfreetime/htauth",
23
- }
24
- spec.license = "MIT"
25
- end
26
-
27
- load 'tasks/default.rake'
data/bin/htdigest-ruby DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- begin
4
- require 'htauth/cli'
5
- rescue LoadError
6
- path = File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
7
- raise if $:.include?(path)
8
- $: << path
9
- retry
10
- end
11
-
12
- HTAuth::CLI::Digest.new.run(ARGV, ENV)
data/bin/htpasswd-ruby DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- begin
4
- require 'htauth/cli'
5
- rescue LoadError
6
- path = File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
7
- raise if $:.include?(path)
8
- $: << path
9
- retry
10
- end
11
-
12
- HTAuth::CLI::Passwd.new.run(ARGV, ENV)
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
- require 'htauth/algorithm'
3
-
4
- describe HTAuth::Algorithm do
5
- it "raises an error if it encouners an unknown algorithm" do
6
- _ { HTAuth::Algorithm.algorithm_from_name("unknown") }.must_raise(::HTAuth::InvalidAlgorithmError)
7
- end
8
- end
data/spec/bcrypt_spec.rb DELETED
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
- require 'htauth/bcrypt'
3
-
4
- describe HTAuth::Bcrypt do
5
- it "encrypts the same way that apache does by default" do
6
- apache_hash = '$2y$05$X7XeXxp0uAO92AGG2P4/fu0mj7MrRDQnlBTkwZLd9rKiH2OUBb9/K'
7
- reparsed = ::BCrypt::Password.new(apache_hash)
8
- cost = reparsed.cost
9
-
10
- _(cost).must_equal HTAuth::Bcrypt::DEFAULT_APACHE_COST
11
- _(reparsed.is_password?("a secret")).must_equal true
12
-
13
- bcrypt = HTAuth::Bcrypt.new(:cost => cost)
14
- local_hash = bcrypt.encode("a secret")
15
-
16
- _(local_hash.is_password?("a secret")).must_equal true
17
- _(local_hash.cost).must_equal cost
18
- end
19
-
20
- it "encrypts the same way that apache does with different cost" do
21
- apache_hash = '$2y$12$O3mBah33UilOkwXrS0kXuOPFBKLBCIp7V.AVvEZQcbnAM5SJLQnfq'
22
- reparsed = ::BCrypt::Password.new(apache_hash)
23
- cost = reparsed.cost
24
-
25
- _(reparsed.is_password?("a secret")).must_equal true
26
-
27
- bcrypt = HTAuth::Bcrypt.new(:cost => cost)
28
- local_hash = bcrypt.encode("a secret")
29
-
30
- _(local_hash.is_password?("a secret")).must_equal true
31
- _(local_hash.cost).must_equal cost
32
- end
33
- end