adds authentication to posts controller