Simplest way to authenticate user in hanami app

If you need the simplest and easiest way to adding authentication logic in your hanami app (to admin app for example) you always can use Rack::Auth::Basic class.

For this you need to add following lines of code to your controller.prepare configuration block:

# apps/admin/application.rb

controller.prepare do
  # ...
  # some code

  use Rack::Auth::Basic, 'Message' do |username, password|
    username == 'admin' && password == 'password'

Happy authenticating!

P.S.: also if you need something more complicated you can reed this thread on hanami forum.