@Override public void removeUser(DemoiselleUser user) { repo.entrySet() .stream() .filter((entry) -> (entry.getValue().getIdentity().equalsIgnoreCase(user.getIdentity()))) .forEach( (entry) -> { token.setKey(entry.getKey()); }); removeToken(); }
/** @param user */ @Override public void setUser(DemoiselleUser user) { token.setKey(null); repo.entrySet() .stream() .filter((entry) -> (entry.getValue().getIdentity().equalsIgnoreCase(user.getIdentity()))) .forEach( (entry) -> { token.setKey(entry.getKey()); }); if (token.getKey() == null) { String value = randomUUID().toString(); repo.putIfAbsent(value, user.clone()); token.setKey(value); } token.setType("Token"); }