try {
// For authentication the only thing we need to do is call Application.authenticate(),
// instantiating the proper AuthenticationRequest (UsernamePasswordRequest in this case),
// providing the account's credentials.
AuthenticationRequest request = new UsernamePasswordRequest(customer.getUserName(), customer.getPassword());
AuthenticationResult authcResult = stormpath.getApplication().authenticateAccount(request);
Account account = authcResult.getAccount();
User user = new User(account);