@Override public boolean checkCredentials(final SUser user, final String password) { final String hashPassword = user.getPassword(); return encrypter.check(password, hashPassword); }
@Override public SUser createUser(final SUser user) throws SUserCreationException { final String methodName = "createUser"; final String hash = encrypter.hash(user.getPassword()); final SUser hashedUser = BuilderFactory.get(SUserBuilderFactory.class).createNewInstance(user).setPassword(hash).done(); return createUser(user, methodName, hashedUser); }
@Override public SUser createUser(final SUser user) throws SUserCreationException { final String methodName = "createUser"; final String hash = encrypter.hash(user.getPassword()); final SUser hashedUser = BuilderFactory.get(SUserBuilderFactory.class).createNewInstance(user).setPassword(hash).done(); return createUser(user, methodName, hashedUser); }
@Deprecated @Override public void updateUser(final SUser user, final EntityUpdateDescriptor descriptor, final boolean isPasswordEncrypted) throws SUserUpdateException { final String methodName = "updateUser"; if (!isPasswordEncrypted) { final String password = (String) descriptor.getFields().get("password"); if (password != null) { final String hash = encrypter.hash(password); descriptor.getFields().put("password", hash); } } final SUserLogBuilder logBuilder = getUserLog(ActionType.UPDATED, "Updating user with user name " + user.getUserName() + ", first name " + user.getFirstName() + ", last name " + user.getLastName()); try { recorder.recordUpdate(UpdateRecord.buildSetFields(user, descriptor), USER); log(user.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException re) { log(user.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SUserUpdateException(re); } }
@Override public boolean checkCredentials(final SUser user, final String password) { final String hashPassword = user.getPassword(); return encrypter.check(password, hashPassword); }
@Deprecated @Override public void updateUser(final SUser user, final EntityUpdateDescriptor descriptor, final boolean isPasswordEncrypted) throws SUserUpdateException { final String methodName = "updateUser"; if (!isPasswordEncrypted) { final String password = (String) descriptor.getFields().get("password"); if (password != null) { final String hash = encrypter.hash(password); descriptor.getFields().put("password", hash); } } final SUserLogBuilder logBuilder = getUserLog(ActionType.UPDATED, "Updating user with user name " + user.getUserName() + ", first name " + user.getFirstName() + ", last name " + user.getLastName()); try { recorder.recordUpdate(UpdateRecord.buildSetFields(user, descriptor), USER); log(user.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException re) { log(user.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SUserUpdateException(re); } }