Adding reusable authentication code