use of org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder in project nixmash-blog by mintster.
the class UserPasswordControllerTests method loggedInUserPasswordIsUpdated.
@Test
public void loggedInUserPasswordIsUpdated() throws Exception {
RequestBuilder request = post("/users/resetpassword").param("userId", "4").param("password", "password").param("repeatedPassword", "password").with(csrf());
mvc.perform(request);
Optional<User> user = userService.getUserById(4L);
if (user.isPresent()) {
String encodedPassword = user.get().getPassword();
assertTrue(new BCryptPasswordEncoder().matches("password", encodedPassword));
}
}
use of org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder in project spring-thymeleaf-simplefinance by heitkergm.
the class SpringSecurityConfig method configure.
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
auth.userDetailsService(userDetailsService).passwordEncoder(encoder);
}
use of org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder in project flytecnologia-api by jullierme.
the class FlyGeneratePassword method main.
public static void main(String[] args) {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
System.out.println(encoder.encode("admin"));
}
use of org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder in project tutorials by eugenp.
the class DummyContentUtil method generateDummyUsers.
public static final List<AppUser> generateDummyUsers() {
List<AppUser> appUsers = new ArrayList<>();
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
appUsers.add(new AppUser("Lionel Messi", "lionel@messi.com", passwordEncoder.encode("li1234")));
appUsers.add(new AppUser("Cristiano Ronaldo", "cristiano@ronaldo.com", passwordEncoder.encode("c1234")));
appUsers.add(new AppUser("Neymar Dos Santos", "neymar@neymar.com", passwordEncoder.encode("n1234")));
appUsers.add(new AppUser("Luiz Suarez", "luiz@suarez.com", passwordEncoder.encode("lu1234")));
appUsers.add(new AppUser("Andres Iniesta", "andres@iniesta.com", passwordEncoder.encode("a1234")));
appUsers.add(new AppUser("Ivan Rakitic", "ivan@rakitic.com", passwordEncoder.encode("i1234")));
appUsers.add(new AppUser("Ousman Dembele", "ousman@dembele.com", passwordEncoder.encode("o1234")));
appUsers.add(new AppUser("Sergio Busquet", "sergio@busquet.com", passwordEncoder.encode("s1234")));
appUsers.add(new AppUser("Gerard Pique", "gerard@pique.com", passwordEncoder.encode("g1234")));
appUsers.add(new AppUser("Ter Stergen", "ter@stergen.com", passwordEncoder.encode("t1234")));
return appUsers;
}
use of org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder in project mots by motech-implementations.
the class UserService method registerNewUser.
/**
* Create User with new encoded password.
*
* @param user User to be created.
* @return created User
*/
@PreAuthorize(RoleNames.HAS_MANAGE_USERS_OR_MANAGE_INCHARGE_USERS_ROLE)
public User registerNewUser(User user) {
String newPasswordEncoded = new BCryptPasswordEncoder().encode(user.getPassword());
user.setPassword(newPasswordEncoded);
return validateAndSave(user);
}
Aggregations