Moved auth logic to its own plugin