private void prepareTokenFile ( final String user , final Credentials credentials , final File tokenFile , final Logger logger ) throws IOException { writeCredentialsToFile ( credentials , tokenFile , logger ) ; try { assignPermissions ( user , tokenFile , logger ) ; } catch ( final IOException e ) { // On any error managing token file. delete the file tokenFile . delete ( ) ; throw e ; } }
Prepare token file . Writes credentials to a token file and sets appropriate permissions to keep the file secure