/** * Generates a random password in a format suitable for presentation as an authentication credential. */ public String generatePassword() { String password = passwordGenerator.allocateToken("").getKey(); return password.length() <= User.PASSWORD_LEN_MAX ? password : password.substring(0, User.PASSWORD_LEN_MAX - 1); }
@Override public ActionToken decryptToken(String aTokenKey) { Token token = tokenService.verifyToken(aTokenKey); return decryptTokenFromString(token.getExtendedInformation()); }
/** * Generates a random password in a format suitable for presentation as an authentication credential. */ public String generatePassword() { String password = passwordGenerator.allocateToken("").getKey(); return password.length() <= User.PASSWORD_LEN_MAX ? password : password.substring(0, User.PASSWORD_LEN_MAX - 1); }
@Override public String generateToken(ActionToken actionToken) { Token token = tokenService.allocateToken(encryptTokenAsString(actionToken)); return token.getKey(); }
@Override public void createTicket(Item item, Ticket ticket) { if (ticket == null) { throw new IllegalArgumentException("ticket cannot be null"); } if (item == null) { throw new IllegalArgumentException("item cannot be null"); } User owner = ticket.getOwner(); if (owner == null) { throw new IllegalArgumentException("ticket must have owner"); } if (ticket.getKey() == null) { ticket.setKey(ticketKeyGenerator.allocateToken("").getKey()); } ticket.setCreated(new Date()); item.addTicket(ticket); this.em.persist(ticket); this.em.merge(item); this.em.flush(); }
@Override public void createTicket(Item item, Ticket ticket) { if (ticket == null) { throw new IllegalArgumentException("ticket cannot be null"); } if (item == null) { throw new IllegalArgumentException("item cannot be null"); } User owner = ticket.getOwner(); if (owner == null) { throw new IllegalArgumentException("ticket must have owner"); } if (ticket.getKey() == null) { ticket.setKey(ticketKeyGenerator.allocateToken("").getKey()); } ticket.setCreated(new Date()); item.addTicket(ticket); this.em.persist(ticket); this.em.merge(item); this.em.flush(); }
protected void setBaseItemProps(Item item) { if (item.getUid() == null) { item.setUid(idGenerator.nextStringIdentifier()); } if (item.getName() == null) { item.setName(item.getUid()); } if (item instanceof ICalendarItem) { ICalendarItem ical = (ICalendarItem) item; if (ical.getIcalUid() == null) { ical.setIcalUid(item.getUid()); EventStamp es = HibEventStamp.getStamp(ical); if (es != null) { es.setIcalUid(ical.getIcalUid()); } } } for (Ticket ticket : item.getTickets()) { if (ticket.getOwner() == null) { ticket.setOwner(item.getOwner()); } if (ticket.getKey() == null) { ticket.setKey(ticketKeyGenerator.allocateToken("").getKey()); } if (ticket.getTimeout() == null) { ticket.setTimeout(Ticket.TIMEOUT_INFINITE); } ticket.setCreated(new Date()); } }
protected void setBaseItemProps(Item item) { if (item.getUid() == null) { item.setUid(idGenerator.nextStringIdentifier()); } if (item.getName() == null) { item.setName(item.getUid()); } if (item instanceof ICalendarItem) { ICalendarItem ical = (ICalendarItem) item; if (ical.getIcalUid() == null) { ical.setIcalUid(item.getUid()); EventStamp es = HibEventStamp.getStamp(ical); if (es != null) { es.setIcalUid(ical.getIcalUid()); } } } for (Ticket ticket : item.getTickets()) { if (ticket.getOwner() == null) { ticket.setOwner(item.getOwner()); } if (ticket.getKey() == null) { ticket.setKey(ticketKeyGenerator.allocateToken("").getKey()); } if (ticket.getTimeout() == null) { ticket.setTimeout(Ticket.TIMEOUT_INFINITE); } ticket.setCreated(new Date()); } }