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() 

Source Link

Usage

From source file:com.thesoftwareguild.capstoneblog.controller.PWEnc.java

public static void main(String[] args) {
    String clearTxtPw = "password";
    // BCrypt//from w ww.j ava2 s . co  m
    BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
    String hashedPw = encoder.encode(clearTxtPw);
    System.out.println(hashedPw);
    System.out.println(hashedPw.length());

}

From source file:com.cfs.util.BCryptTeste.java

public static void main(String[] args) {

    int i = 0;//from   www .j  a va  2  s  .c  o  m
    while (i < 10) {
        String password = "root";
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String hashedPassword = passwordEncoder.encode(password);

        System.out.println(Utilities.getInstance().getLineNumber() + hashedPassword);
        i++;
    }
}

From source file:com.micromap.util.BCryptTeste.java

public static void main(String[] args) {

    int i = 0;/*ww w  .j a  v  a 2  s . com*/
    while (i < 1) {
        String password = "102030";
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String hashedPassword = passwordEncoder.encode(password);

        System.out.println(hashedPassword);
        i++;
    }
}

From source file:com.springbootsecure.utils.QuickPasswordEncodingGenerator.java

/**
 * Generates encrypted 'admin' and 'user' passwords
 * @param args//from   www .jav  a 2s  .  co  m
 */
public static void main(String[] args) {
    BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
    String password = "admin";
    System.out.println("admin: " + passwordEncoder.encode(password));
    password = "user";
    System.out.println("user: " + passwordEncoder.encode(password));
    password = "password";
    System.out.println("password: " + passwordEncoder.encode(password));
}

From source file:com.sg.capstone.controller.PWEnc.java

public static void main(String[] args) {
    String[] passwords = { "adminpassword", "password" };
    for (String clearTxtPw : passwords) {
        // BCrypt
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String hashedPw = encoder.encode(clearTxtPw);
        System.out.println(clearTxtPw + "::" + hashedPw);
    }/*from   w  w w  .j  a  va2s .  c  o  m*/
}

From source file:com.enpoc.test.NewMain.java

/**
 * @param args the command line arguments
 */// www .j ava2s . c  o  m
public static void main(String[] args) throws URISyntaxException {
    // TODO code application logic here
    System.out.println("main method is  called");
    //        PersonServiceImpl personObj = new PersonServiceImpl();
    //        List<Person> personList = personObj.findAllUsers();
    //        System.out.println("personList " + personList);

    //        ClassLoader cl = ClassLoader.getSystemClassLoader();
    //
    //        URL[] urls = ((URLClassLoader)cl).getURLs();
    //
    //        for(URL url: urls){
    //           System.out.println(url.getFile());
    //        }
    //        
    BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
    String hashedPassword = passwordEncoder.encode("welcome");
    System.out.println("password" + hashedPassword);
}

From source file:com.kylinolap.rest.security.PasswordPlaceholderConfigurer.java

public static void main(String[] args) {
    BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
    System.out.println(bCryptPasswordEncoder.encode("MODELER"));
}

From source file:org.ng200.openolympus.Application.java

public static void main(final String[] args) {
    final ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
    final UserRepository userRepository = context.getBean(UserRepository.class);
    final RoleService roleService = context.getBean(RoleService.class);
    if (userRepository.findByUsername("admin") == null) {
        Application.logger.info("Creating administrator account");
        final User admin = new User("admin", new BCryptPasswordEncoder().encode("admin"), "", "", "", "", "",
                "", "", "", "", "", "", "", "", "", "", "", "", null);
        final Set<Role> roles = new HashSet<Role>();
        roles.add(roleService.getRoleByName(Role.USER));
        roles.add(roleService.getRoleByName(Role.SUPERUSER));
        admin.setRoles(roles);/*from   ww w  . j  a  v  a 2 s  .  c o m*/
        userRepository.save(admin);
    }
    final ThreadPoolTaskExecutor taskExecutor = context.getBean(ThreadPoolTaskExecutor.class);
    taskExecutor.execute(context.getBean(TestingService.class));
}

From source file:com.sothawo.taboo2.Taboo2UserService.java

/**
 * encodes the string that is given as argument.
 *
 * @param args// www. ja v a  2  s.c om
 *         program arguments.
 */
public static void main(String[] args) {
    if (args.length > 0) {
        System.out.printf(new BCryptPasswordEncoder().encode(args[0]));
    }
}

From source file:cz.fi.muni.pa036.airticketbooking.rest.HashCode.java

public static String getHashPassword(String password) {
    BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
    String hashedPassword = passwordEncoder.encode(password);

    System.out.println(hashedPassword);
    return hashedPassword;
}