added api security middleware