add api auth middleware
refactor api v2 authenticator
auth with middleware