A middleware handler that does api-key verification.