Simplify Public Rest Api Authentication Logic