move authentication code to secure store