implement auth functions