Moved authentication logic into Auth extension