Implement authetnication in agentcontroller