Refactor auth middleware to avoid code duplication.

ref: https://codeclimate.com/github/intridea/grape/Grape::Middleware::Auth::Basic
Merge pull request #459 from siong1987/refactor_auth_middleware

Refactor auth middleware to avoid code duplication.