Method: Narou::AppServer#setup_server_authentication

Defined in:
lib/web/appserver.rb

#setup_server_authenticationObject

サーバーの認証の設定とりあえずDigest認証のみ



274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/web/appserver.rb', line 274

def setup_server_authentication
  auth = Inventory.load("global_setting", :global).group("server-digest-auth")
  return unless auth.enable

  user = auth.user
  hashed = auth.hashed_password
  passwd = hashed || auth.password

  self.class.class_exec do
    use Rack::Auth::Digest::MD5, { realm: "narou.rb", opaque: "", passwords_hashed: hashed } do |username|
      passwd if username == user
    end
  end
end