If HTTP Authentication is enforced, the user's name is available in the request object, for instance:
use Rack::Auth::Basic,"Protected Area" do |username, password|
User.validate username, password
end
get '/' do
user = request.env["REMOTE_USER"]
"Hello, #{user}"
end
Please note that the HTTP authentication scheme can be awkward to use, you might want to consider using sessions instead.