Example usage for org.springframework.security.crypto.bcrypt BCryptPasswordEncoder BCryptPasswordEncoder

List of usage examples for org.springframework.security.crypto.bcrypt BCryptPasswordEncoder BCryptPasswordEncoder

Introduction

In this page you can find the example usage for org.springframework.security.crypto.bcrypt BCryptPasswordEncoder BCryptPasswordEncoder.

Prototype

public BCryptPasswordEncoder(BCryptVersion version) 

Source Link

Usage

From source file:org.openwms.core.UAAStarter.java

public @Bean PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder(15);
}

From source file:ru.codemine.ccms.service.EmployeeService.java

@Transactional
public void create(Employee employee) {
    BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(11);
    String encodedPass = passwordEncoder.encode(employee.getPassword());

    employee.setPassword(encodedPass);//from   w w w.  j  a  v  a 2  s  .  c o m
    employeeDAO.create(employee);
}

From source file:org.homiefund.config.SecurityConfiguration.java

@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
    return new BCryptPasswordEncoder(10);
}

From source file:runtheshow.frontend.config.SecurityConfiguration.java

@Override
protected void configure(AuthenticationManagerBuilder registry) throws Exception {
    // l'authentification est faite par jdbc authentication en attendant de pouvoir utiliser appUserDetailservice
    // le mot de passe est crypt par l'algorithme de hachage BCrypt

    AppConfiguration uneConfiguration = new AppConfiguration();
    DataSource ds = uneConfiguration.dataSource();

    final String findUserQuery = "select user_login,user_password,user_enabled " + "from users "
            + "where user_login = ?";

    final String findRoles = "select u.user_login,r.role_name " + "from roles r, users u, users_roles ur "
            + "where u.user_login = ? and u.id = ur.user_id and ur.role_id = r.id";

    registry.jdbcAuthentication().dataSource(ds).usersByUsernameQuery(findUserQuery)
            .authoritiesByUsernameQuery(findRoles).passwordEncoder(new BCryptPasswordEncoder(12));

    //registry.userDetailsService(appUserDetailsService);
}

From source file:fr.lepellerin.ecole.config.GestEcoleSecurityConfig.java

@Bean
public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder(11);
}

From source file:uk.co.caprica.bootlace.BootlaceApplication.java

/**
 * Configure a password encoder to use when creating new user accounts.
 *
 * @return password encoder component/*from  w ww . ja  v a  2 s  .c o  m*/
 */
@Bean
public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder(passwordEncoderStrength);
}

From source file:org.openwms.core.uaa.SystemUserWrapperTest.java

/**
 * Test method for/*w w  w .  j  a v  a 2 s . c  o m*/
 * <ul>
 * <li>
 * {@link SystemUserWrapper#getPassword()}.</li>
 * <li>
 * {@link SystemUserWrapper#setPassword(java.lang.String)}
 * </li>
 * </ul>
 */
@Ignore
@Test
public final void testGetPassword() throws Exception {
    User user = new User(TEST_USER);
    BCryptPasswordEncoder enc = new BCryptPasswordEncoder(15);
    user.changePassword(enc.encode("PASS"), "PASS", enc);
    SystemUserWrapper suw = new SystemUserWrapper(user);
    Assert.assertEquals("PASS", suw.getPassword());
}

From source file:org.openwms.core.uaa.UserWrapperTest.java

/**
 * Test method for/*from   w  ww  . j a v a 2  s .c  o  m*/
 * {@link UserWrapper#getPassword()}.
 * 
 * @throws Exception
 */
@Ignore
@Test
public final void testGetPassword() throws Exception {
    User u = new User(TEST_USER);
    BCryptPasswordEncoder enc = new BCryptPasswordEncoder(15);
    u.changePassword(enc.encode("PASS"), "PASS", enc);
    UserWrapper uw = new UserWrapper(u);
    Assert.assertEquals("PASS", uw.getPassword());
}

From source file:com.juliuskrah.multipart.RootConfig.java

@Bean
public PasswordEncoder encoder() {
    return new BCryptPasswordEncoder(10);
}

From source file:br.com.hyperclass.snackbar.config.SecurityConfiguration.java

@Bean
public PasswordEncoder encoder() {
    return new BCryptPasswordEncoder(5);
}