org.springframework.security.authentication.encoding.ShaPasswordEncoder Java Examples
The following examples show how to use
org.springframework.security.authentication.encoding.ShaPasswordEncoder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MD5Test.java From paascloud-master with Apache License 2.0 | 5 votes |
/** * Sha sha 256. */ private static void sha_SHA_256() { ShaPasswordEncoder sha = new ShaPasswordEncoder(); sha.setEncodeHashAsBase64(false); String pwd = sha.encodePassword("123456", null); log.info("哈希算法 SHA-256: " + pwd + " len=" + pwd.length()); }
Example #2
Source File: UserServiceImpl.java From AppStash with Apache License 2.0 | 5 votes |
@Autowired public UserServiceImpl(@Qualifier("userRepository") UserRepository repository, @Qualifier("dozerMapper") Mapper dozerMapper, @Qualifier("userPasswordEncoder") ShaPasswordEncoder passwordEncoder) { super(repository, dozerMapper, UserInfo.class, User.class); this.userRepository = repository; this.passwordEncoder = passwordEncoder; }
Example #3
Source File: UserService.java From JDeSurvey with GNU Affero General Public License v3.0 | 5 votes |
@Transactional(readOnly = false) public User user_merge(User user) { //create save the password if (user.getId() == null) { user.setCreationDate(new Date()); user.setLastUpdateDate(new Date()); PasswordEncoder encoder = new ShaPasswordEncoder(256); user.setPassword(encoder.encodePassword(user.getPassword(), user.getSalt())); return userDAO.merge(user); } else //update do not update the password { User dbUser = userDAO.findById(user.getId()); dbUser.setLastUpdateDate(new Date()); dbUser.setLogin(user.getLogin()); dbUser.setFirstName(user.getFirstName()); dbUser.setDateOfBirth(user.getDateOfBirth()); dbUser.setMiddleName(user.getMiddleName()); dbUser.setLastName(user.getLastName()); dbUser.setEmail(user.getEmail()); dbUser.setEnabled(user.getEnabled()); dbUser.setGroups(user.getGroups()); dbUser.setDepartments(user.getDepartments()); dbUser.setSurveyDefinitions(user.getSurveyDefinitions()); return userDAO.merge(dbUser); } }
Example #4
Source File: UserService.java From JDeSurvey with GNU Affero General Public License v3.0 | 5 votes |
@Transactional(readOnly = false) public User user_updatePassword(User user, PasswordResetRequest passwordResetRequest) { //update the request passwordResetRequest.setResetDate(new Date()); passwordResetRequestDAO.merge(passwordResetRequest); //update password User dbUser = userDAO.findById(user.getId()); dbUser.setLastUpdateDate(new Date()); PasswordEncoder encoder = new ShaPasswordEncoder(256); dbUser.setPassword(encoder.encodePassword(user.getPassword(), user.getSalt())); return userDAO.merge(dbUser); }
Example #5
Source File: UserService.java From JDeSurvey with GNU Affero General Public License v3.0 | 5 votes |
@Transactional(readOnly = false) public User user_updatePassword(User user) { User dbUser = userDAO.findById(user.getId()); dbUser.setLastUpdateDate(new Date()); PasswordEncoder encoder = new ShaPasswordEncoder(256); dbUser.setPassword(encoder.encodePassword(user.getPassword(), user.getSalt())); return userDAO.merge(dbUser); }
Example #6
Source File: UserService.java From JDeSurvey with GNU Affero General Public License v3.0 | 5 votes |
public String user_prepareForgotPasswordMessage(Long id) { try { User user = userDAO.findById(id); PasswordEncoder encoder = new ShaPasswordEncoder(256); String hash = encoder.encodePassword(user.getEmail() + new Date().getTime(), user.getSalt()); PasswordResetRequest passwordResetRequest = new PasswordResetRequest(user.getLogin() ,hash); passwordResetRequestDAO.merge(passwordResetRequest); return hash; } catch (Exception e) { log.error(e.getMessage(),e); throw (new RuntimeException(e)); } }
Example #7
Source File: InternalAuthenticationProvider.java From osiam with MIT License | 5 votes |
@Autowired public InternalAuthenticationProvider(SCIMUserProvisioning userProvisioning, ShaPasswordEncoder shaPasswordEncoder, BCryptPasswordEncoder bCryptPasswordEncoder, @Value("${osiam.tempLock.count:0}") Integer maxLoginFailures, @Value("${osiam.tempLock.timeout:0}") Integer lockTimeout) { this.userProvisioning = userProvisioning; this.shaPasswordEncoder = shaPasswordEncoder; this.bCryptPasswordEncoder = bCryptPasswordEncoder; this.maxLoginFailures = maxLoginFailures; this.lockTimeout = lockTimeout; }
Example #8
Source File: UserServiceImpl.java From the-app with Apache License 2.0 | 5 votes |
@Autowired public UserServiceImpl(@Qualifier("userRepository") UserRepository repository, @Qualifier("dozerMapper") Mapper dozerMapper, @Qualifier("userPasswordEncoder") ShaPasswordEncoder passwordEncoder) { super(repository, dozerMapper, UserInfo.class, User.class); this.userRepository = repository; this.passwordEncoder = passwordEncoder; }
Example #9
Source File: CartPasswordEncoder.java From Spring-MVC-Blueprints with MIT License | 5 votes |
public static void main(String[] args) { ShaPasswordEncoder enc = new ShaPasswordEncoder(512); enc.setIterations(1000); enc.setEncodeHashAsBase64(true); String encodedPass = enc.encodePassword("nesa", "nesa"); System.out.println(encodedPass); System.out.println(enc.isPasswordValid(encodedPass, "nesa", "nesa")); }
Example #10
Source File: MD5Test.java From paascloud-master with Apache License 2.0 | 5 votes |
/** * Sha 256. * */ private static void sha_256() { ShaPasswordEncoder sha = new ShaPasswordEncoder(256); sha.setEncodeHashAsBase64(true); String pwd = sha.encodePassword("123456", null); log.info("哈希算法 256: " + pwd + " len=" + pwd.length()); }
Example #11
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #12
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #13
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #14
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #15
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #16
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #17
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #18
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #19
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #20
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #21
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #22
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #23
Source File: Sha256PasswordEncoderMain.java From Spring-Security-Third-Edition with MIT License | 4 votes |
public static String encode(String password) { ShaPasswordEncoder encoder = new ShaPasswordEncoder(256); String encodedPassword = encoder.encodePassword(password, null); return encodedPassword; }
Example #24
Source File: SecurityConfig.java From incubator-wikift with Apache License 2.0 | 4 votes |
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService) .passwordEncoder(new ShaPasswordEncoder(AuthorizationSupport.ENGING_STRENGTH)); }
Example #25
Source File: SecurityConfig.java From Spring-Security-Third-Edition with MIT License | 2 votes |
/** * Standard SHA-256 Password Encoder * @return ShaPasswordEncoder * * @see ShaPasswordEncoder */ @Bean public PasswordEncoder passwordEncoder(){ return new ShaPasswordEncoder(256); }