Added authentication mechanism + unit tests