Protect authentication against endless loops and recursions