protected boolean isLocalAccount(String username) { ILocalAccountPerson person = accountDao.getPerson(username); if (person != null) { return true; } else { return false; } }
public boolean validateLoginToken(String username, String token) { ILocalAccountPerson person = accountDao.getPerson(username); if (person != null) { Object recordedToken = person.getAttributeValue("loginToken"); if (recordedToken != null && recordedToken.equals(token)) { if (log.isInfoEnabled()) { log.info("Successfully validated security token for user: " + username); } return true; } else { if (log.isInfoEnabled()) { log.info( "Unable to validate security token; recordedToken=" + recordedToken + ", submitted token=" + token); } } } else { if (log.isInfoEnabled()) { log.info("Unable to validate security token; person not found: " + username); } } return false; }
@Override @Transactional public boolean updatePassword(String user, boolean create) throws IOException { // Make sure user is specified correctly if (StringUtils.isBlank(user)) { System.err.println("You did not specify a valid user name. Please try again."); return false; } // attempt to get the account form the database ILocalAccountPerson account = this.localAccountDao.getPerson(user); if (account == null) { if (!create) { System.err.println("No such user: " + user); return false; } account = this.localAccountDao.createPerson(user); } System.out.print("Enter Password for " + user + ": "); System.out.flush(); // Needed for prompt to appear when running from Ant. final BufferedReader d = new BufferedReader(new InputStreamReader(System.in, UTF_8)); final String spass = d.readLine(); // update the user's password final String encryptedPassword = this.portalPasswordService.encryptPassword(spass); account.setPassword(encryptedPassword); this.localAccountDao.updateAccount(account); System.out.println("Password Updated..."); return true; }
public void deleteAccount(IPerson currentUser, String target) { if (!canDeleteUser(currentUser, target)) { throw new RuntimeException( "Current user " + currentUser.getName() + " does not have permissions to update person " + target); } ILocalAccountPerson person = accountDao.getPerson(target); accountDao.deleteAccount(person); log.info("Account " + person.getName() + " successfully deleted"); }
@Override @Transactional public void updatePassword(String user, String spass, boolean create) throws IOException { // Make sure user is specified correctly if (StringUtils.isBlank(user)) { throw new IllegalArgumentException( "You did not specify a valid user name. Please try again."); } // attempt to get the account form the database ILocalAccountPerson account = this.localAccountDao.getPerson(user); if (account == null) { if (!create) { throw new IllegalArgumentException("No such user: " + user); } account = this.localAccountDao.createPerson(user); } // update the user's password final String encryptedPassword = this.portalPasswordService.encryptPassword(spass); account.setPassword(encryptedPassword); this.localAccountDao.updateAccount(account); logger.info("Password Updated for: {}", user); } }
String first_name, last_name; ILocalAccountDao accountStore = LocalAccountDaoLocator.getLocalAccountDao(); ILocalAccountPerson account = accountStore.getPerson(this.myPrincipal.UID); if (account != null) { first_name = (String) account.getAttributeValue("given");
ILocalAccountPerson account = accountStore.getPerson(this.myPrincipal.UID);
userType.setUsername(userName); final ILocalAccountPerson localAccountPerson = this.localAccountDao.getPerson(userName); if (localAccountPerson != null) { userType.setPassword(localAccountPerson.getPassword());
ILocalAccountPerson account = accountDao.getPerson(username); account.setPassword(passwordService.encryptPassword(password)); account.setLastPasswordChange(new Date());
public PersonForm getForm(String username) { ILocalAccountPerson person = accountDao.getPerson(username); PersonForm form = new PersonForm(accountEditAttributes); form.setUsername(person.getName()); form.setId(person.getId()); Set<String> attributeNames = accountDao.getCurrentAttributeNames(); for (String name : attributeNames) { List<String> values = new ArrayList<String>(); List<Object> attrValues = person.getAttributeValues(name); if (attrValues != null) { for (Object value : person.getAttributeValues(name)) { values.add((String) value); } } form.getAttributes().put(name, new StringListAttribute(values)); } return form; }
public void validateEditLocalAccount(PersonForm person, MessageContext context) { // ensure that this username isn't already taken if (person.getId() < 0 && accountDao.getPerson(person.getUsername()) != null) { context.addMessage( new MessageBuilder() .error() .source("username") .code("username.in.use") .build()); } if (StringUtils.isNotBlank(person.getPassword()) || StringUtils.isNotBlank(person.getConfirmPassword())) { if (person.getPassword() == null || !person.getPassword().equals(person.getConfirmPassword())) { context.addMessage( new MessageBuilder() .error() .source("password") .code("passwords.must.match") .build()); } } } }
final ILocalAccountPerson person = localAccountDao.getPerson(userName); if (person != null) { localAccountDao.deleteAccount(person);
ILocalAccountPerson account = this.localAccountDao.getPerson(username); final String password = userType.getPassword(); final List<Attribute> attributes = userType.getAttributes();
final ILocalAccountPerson person = localAccountDao.getPerson(userName); if (person != null) { localAccountDao.deleteAccount(person);
ILocalAccountPerson account = accountDao.getPerson(form.getUserId()); if (!passwordService.validatePassword( form.getCurrentPassword(), account.getPassword())) {