Account account = loadAccountByUserName("admin");
if (account == null) {
account = createNewAdminUser("admin", "", "admin");
}
GrantedAuthority[] auths = new GrantedAuthority[1];
auths[0] = new GrantedAuthorityImpl("ROLE_ADMIN");
ApplicationUser user = new ApplicationUser(new Long(account.getId()),
account.getUserName(), account.getPassword(), true, true, true,
true, auths);
Authentication auth = new TestingAuthenticationToken(user, "ignored",
auths);