1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/webrick
normal 9749bfbf73 webrick: Support bcrypt password hashing
This adds a password_hash keyword argument to
WEBrick::HTTPAuth::Htpasswd#initialize.  If set to :bcrypt, it
will create bcrypt hashes instead of crypt hashes, and will
raise an exception if the .htpasswd file uses crypt hashes.

If :bcrypt is used, then instead of calling
BasicAuth.make_passwd (which uses crypt),
WEBrick::HTTPAuth::Htpasswd#set_passwd will set the bcrypt
password directly.  It isn't possible to change the
make_passwd API to accept the password hash format, as that
would break configurations who use Htpasswd#auth_type= to set
a custom auth_type.

This modifies WEBrick::HTTPAuth::BasicAuth to handle checking
both crypt and bcrypt hashes.

There are commented out requires for 'string/crypt', to handle
when String#crypt is deprecated and the undeprecated version is
moved to a gem.

There is also a commented out warning for the case when
the password_hash keyword is not specified and 'string/crypt'
cannot be required.  I think the warning makes sense to nudge
users to using bcrypt.

I've updated the tests to test nil, :crypt, and :bcrypt values
for the password_hash keyword, skipping the bcrypt tests if the
bcrypt library cannot be required.

[ruby-core:88111] [Feature #14940]

From: Jeremy Evans <code@jeremyevans.net>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-26 03:21:52 +00:00
..
httpauth webrick: Support bcrypt password hashing 2018-07-26 03:21:52 +00:00
httpservlet get rid of test error/failure on Windows introduced at r62955 2018-03-28 13:27:35 +00:00
.document
accesslog.rb
cgi.rb webrick: favor .write over << method 2018-03-28 08:05:46 +00:00
compat.rb
config.rb
cookie.rb
htmlutils.rb
httpauth.rb
httpproxy.rb repatch r62966 and r62969. 2018-04-03 10:22:45 +00:00
httprequest.rb repatch r62966 and r62969. 2018-04-03 10:22:45 +00:00
httpresponse.rb webrick/httpresponse: set_redirect requires a valid URI 2018-07-14 02:59:39 +00:00
https.rb
httpserver.rb webrick: compile RE correctly for beginning and end match 2017-12-13 00:38:08 +00:00
httpservlet.rb
httpstatus.rb
httputils.rb webrick/httputils: note Kernel#open behavior 2017-12-22 01:08:05 +00:00
httpversion.rb
log.rb webrick: WEBrick::Log requires path arg when given string 2017-12-22 01:07:55 +00:00
server.rb
ssl.rb
utils.rb
version.rb webrick 1.4.2 2017-12-24 08:38:43 +00:00
webrick.gemspec webrick 1.4.2 2017-12-24 08:38:43 +00:00