Added a check if authentication is needed at all.