List of usage examples for org.springframework.util DigestUtils md5DigestAsHex
public static String md5DigestAsHex(InputStream inputStream) throws IOException
From source file:net.eusashead.hateoas.header.impl.HashingETagHeaderStrategy.java
@Override public ETagHeaderImpl extract(Object entity) { return new ETagHeaderImpl(ETagType.WEAK, DigestUtils.md5DigestAsHex(entity.toString().getBytes())); }
From source file:onlinevideostore.controller.CustomerController.java
@RequestMapping(value = "/addCustomer", method = RequestMethod.POST) public String customerInfor(@Valid Customer customer, BindingResult result) { if (result.hasErrors()) { return "customerRegistration"; } else {/*from w w w . j a v a2 s. co m*/ String md5password = DigestUtils.md5DigestAsHex(customer.getPassword().getBytes()); customer.setPassword(md5password); customer.setRole("ROLE_USER"); customerService.addCustomer(customer); //notification(customer); return "login"; } }
From source file:org.mifos.module.sms.service.SecurityService.java
public String generateApiKey(final String tenantId, final String mifosToken, final String smsProviderAccount, final String smsProviderToken) { try {/* w w w . j a v a2s . co m*/ final String source = tenantId + ":" + mifosToken + ":" + smsProviderAccount + ":" + smsProviderToken; return DigestUtils.md5DigestAsHex(source.getBytes("UTF-8")); } catch (Exception ex) { logger.error("Could not create API key, reason,", ex); throw new IllegalArgumentException(ex); } }
From source file:br.vschettino.forum.dao.UsuarioDAOImpl.java
private boolean validatePassword(Usuario visitante, String senha) { byte[] senhaBytes = (DigestUtils.md5Digest(senha.getBytes())); return (visitante.getSenha().equals(DigestUtils.md5DigestAsHex(senha.getBytes()))); }
From source file:org.cbioportal.session_service.domain.Session.java
public void setData(String data) { this.data = JSON.parse(data); // JSON.serialize it so that formatting is the same if we test later this.checksum = DigestUtils.md5DigestAsHex(JSON.serialize(this.data).getBytes()); }
From source file:org.focusns.service.core.impl.ProjectUserServiceImpl.java
public void createProjectUser(ProjectUser projectUser) { ////from w w w .ja v a 2s . c o m ProjectUser dbProjectUser = projectUserDao.selectByUsername(projectUser.getEmail()); if (dbProjectUser != null) { throw new ServiceException(ServiceExceptionCode.PROJECT_USER_ALREADY_EXIST, "??"); } // //String md5Password = DigestUtils.md5DigestAsHex(projectUser.getPassword().getBytes()); // String md5Password = DigestUtils.md5DigestAsHex(projectUser.getPassword().getBytes()); projectUser.setPassword(md5Password); projectUser.setUsername(projectUser.getEmail()); projectUser.setCreatedAt(new Date()); // projectUserDao.insert(projectUser); }
From source file:org.focusns.service.core.impl.ProjectUserServiceImpl.java
public void modifyProjectUser(ProjectUser projectUser) { ///*w ww . j av a 2 s . c o m*/ if (StringUtils.hasText(projectUser.getOldPassword()) && StringUtils.hasText(projectUser.getNewPassword())) { String oldHashedPassword = DigestUtils.md5DigestAsHex(projectUser.getOldPassword().getBytes()); String newHashedPassword = DigestUtils.md5DigestAsHex(projectUser.getNewPassword().getBytes()); // if (oldHashedPassword.equals(projectUser.getPassword())) { projectUser.setPassword(newHashedPassword); projectUserDao.update(projectUser); } else { throw new ServiceException(ServiceExceptionCode.PASSWORD_MISS_MATCH, "?????"); } } else { projectUserDao.update(projectUser); } }
From source file:cz.muni.fi.pa036.betting.web.UserActionBean.java
public Resolution changeUserInformation() throws UnsupportedEncodingException { log.debug("changeUserInformation()"); user.setPassword(DigestUtils.md5DigestAsHex(getPassword().getBytes("UTF-8"))); Contact contact = new Contact(); contact.setType("email"); contact.setValue(email);/* w w w . j a v a2s . c o m*/ contactService.save(contact); Set<Contact> contacts = new HashSet<Contact>(); contacts.add(contact); user.setContacts(contacts); userService.save(user); System.out.println("------user ------" + user); return new ForwardResolution("/index.jsp"); }
From source file:org.wallride.domain.User.java
public String getGravatarUrl(int size) throws UnsupportedEncodingException { String hash = DigestUtils.md5DigestAsHex(getEmail().getBytes("CP1252")); return String.format("https://secure.gravatar.com/avatar/%s?size=%d&d=mm", hash, size); }