Exemple #1
0
 @PostConstruct
 protected void initialize() {
   accountRepository.deleteAll();
   save(new Account("user", "demo", "ROLE_USER"));
   save(new Account("admin", "admin", "ROLE_ADMIN"));
   save(new Account("*****@*****.**", "qaz123", "ROLE_USER"));
 }
Exemple #2
0
 @Override
 public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
   Account account = accountRepository.findOneByEmail(username);
   if (account == null) {
     throw new UsernameNotFoundException("user not found");
   }
   return createUser(account);
 }
Exemple #3
0
 @Transactional
 public Account save(Account account) {
   account.setPassword(passwordEncoder.encode(account.getPassword()));
   accountRepository.save(account);
   return account;
 }