/** * Removes all users from the USM. */ public void removeAllUsers() { userTable.clear(); fireUsmUserChange(new UsmUserEvent(this, null, UsmUserEvent.USER_REMOVED)); }
public synchronized void usmUserChange(UsmUserEvent event) { usmEventProcessing = true; switch (event.getType()) { case UsmUserEvent.USER_ADDED: { Variable[] values = getValuesFromUsmUser(event.getUser()); OID index = createIndex(event.getUser().getEngineID(), event.getUser().getUserName()); MOMutableRow2PC row = (MOMutableRow2PC) usmUserEntry.createRow(index, values); usmUserEntry.addRow(row); break; } case UsmUserEvent.USER_REMOVED: { if (event.getUser() == null) { usmUserTableModel.clear(); } else { OID index = createIndex(event.getUser().getEngineID(), event.getUser().getUserName()); usmUserEntry.removeRow(index); } } } usmEventProcessing = false; }
/** * Removes all users from the USM. */ public void removeAllUsers() { userTable.clear(); fireUsmUserChange(new UsmUserEvent(this, null, UsmUserEvent.USER_REMOVED)); }
public synchronized void usmUserChange(UsmUserEvent event) { usmEventProcessing = true; switch (event.getType()) { case UsmUserEvent.USER_ADDED: { Variable[] values = getValuesFromUsmUser(event.getUser()); OID index = createIndex(event.getUser().getEngineID(), event.getUser().getUserName()); MOMutableRow2PC row = usmUserEntry.createRow(index, values); usmUserEntry.addRow(row); if (event.getUser() == null) { usmUserTableModel.clear(); OID index = createIndex(event.getUser().getEngineID(), event.getUser().getUserName()); usmUserEntry.removeRow(index); OID index = createIndex(event.getUser().getEngineID(), event.getUser().getUserName()); MOMutableRow2PC row = usmUserEntry.getModel().getRow(index); if (row != null) { UsmUser user = event.getUser().getUsmUser(); row.setValue(colUsmUserAuthProtocol, user.getAuthenticationProtocol()); row.setValue(colUsmUserPrivProtocol, user.getPrivacyProtocol()); row.setValue(colUsmUserPrivPassword, user.getPrivacyPassphrase()); row.setValue(colUsmUserLocalizationEngineID, user.getLocalizationEngineID()); row.setValue(colUsmUserAuthKey, (event.getUser().getAuthenticationKey() == null) ? null : new OctetString(event.getUser().getAuthenticationKey())); row.setValue(colUsmUserPrivKey, (event.getUser().getPrivacyKey() == null) ?
/** * Removes all users from the USM. */ public void removeAllUsers() { userTable.clear(); fireUsmUserChange(new UsmUserEvent(this, null, UsmUserEvent.USER_REMOVED)); }
/** * Updates the USM user entry with the same engine ID and user name as the * supplied instance and fires an appropriate <code>UsmUserEvent</code>. * If the corresponding user entry does not yet exist then it will be added. * @param entry * an <code>UsmUserEntry</code> instance not necessarily the same as an * already existing entry. * @since 1.2 */ public void updateUser(UsmUserEntry entry) { UsmUserEntry oldEntry = userTable.addUser(entry); fireUsmUserChange(new UsmUserEvent(this, entry, (oldEntry == null) ? UsmUserEvent.USER_ADDED: UsmUserEvent.USER_CHANGED)); }
/** * Adds an USM user to the internal user name table. * The user's security name is used as userName. * The storage type member of the supplied by {@link UsmUserEntry#getStorageType()} defines the storage type * of the new USM user table entry. * * Caution: This is a low level call and the provided UsmUserEntry must contain already correctly localized * authentication and privacy keys as well as a correct user engine ID. * * @param usmUserEntry * the {@link UsmUserEntry} to add. * @since 2.5.7 */ public void addUsmUserEntry(UsmUserEntry usmUserEntry) { userTable.addUser(usmUserEntry); fireUsmUserChange(new UsmUserEvent(this, usmUserEntry, UsmUserEvent.USER_ADDED)); }
/** * Adds an USM user to the internal user name table. * The user's security name is used as userName. * The storage type member of the supplied by {@link UsmUserEntry#getStorageType()} defines the storage type * of the new USM user table entry. * <p> * Caution: This is a low level call and the provided UsmUserEntry must contain already correctly localized * authentication and privacy keys as well as a correct user engine ID. * * @param usmUserEntry * the {@link UsmUserEntry} to add. * * @since 2.5.7 */ public void addUsmUserEntry(UsmUserEntry usmUserEntry) { userTable.addUser(usmUserEntry); fireUsmUserChange(new UsmUserEvent(this, usmUserEntry, UsmUserEvent.USER_ADDED)); }
/** * Removes all USM user from the internal user name table with the specified user * name and (optional) engine ID. If the engine ID is not provided (null) * then any user (including localized) are removed that have the specified user name. * * @param userName * a user name. * @param engineID * the authoritative engine ID associated with the user by localization, or * {@code null} if all users with {@code userName} should be * deleted. * * @return the removed {@code UsmUser} instances as a List. If the user could * be found, an empty list is returned. * @since 2.2 */ public List<UsmUser> removeAllUsers(OctetString userName, OctetString engineID) { List<UsmUserEntry> entries = userTable.removeAllUsers(userName, engineID); if (!entries.isEmpty()) { List<UsmUser> users = new ArrayList<UsmUser>(); for (UsmUserEntry entry : entries) { users.add(entry.getUsmUser()); fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_REMOVED)); } return users; } return Collections.emptyList(); }
/** * Removes all USM user from the internal user name table with the specified user * name and (optional) engine ID. If the engine ID is not provided (null) * then any user (including localized) are removed that have the specified user name. * * @param userName * a user name. * @param engineID * the authoritative engine ID associated with the user by localization, or * {@code null} if all users with {@code userName} should be * deleted. * @return * the removed {@code UsmUser} instances as a List. If the user could * be found, an empty list is returned. * @since * 2.2 */ public List<UsmUser> removeAllUsers(OctetString userName, OctetString engineID) { List<UsmUserEntry> entries = userTable.removeAllUsers(userName, engineID); if (!entries.isEmpty()) { List<UsmUser> users = new ArrayList<UsmUser>(); for (UsmUserEntry entry : entries) { users.add(entry.getUsmUser()); fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_REMOVED)); } return users; } return Collections.emptyList(); }
/** * Removes an USM user from the internal user name table. * * @param engineID * the authoritative engine ID associated with the user, or * {@code null} * @param userName * a user name. * * @return the removed {@code UsmUser} instance associate with the given * {@code userName} or {@code null} if such a user could not * be found. * @deprecated If the engineID {@code null} is provided this method does only * delete the generic user. All already localized users will not be deleted. * To delete those users too, use {@link #removeAllUsers(OctetString, OctetString)} instead. */ @Deprecated public UsmUser removeUser(OctetString engineID, OctetString userName) { UsmUserEntry entry = userTable.removeUser(engineID, userName); if (entry != null) { fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_REMOVED)); return entry.getUsmUser(); } return null; }
/** * Removes an USM user from the internal user name table. * @param engineID * the authoritative engine ID associated with the user, or * <code>null</code> * @param userName * a user name. * @return * the removed <code>UsmUser</code> instance associate with the given * <code>userName</code> or <code>null</code> if such a user could not * be found. */ public UsmUser removeUser(OctetString engineID, OctetString userName) { UsmUserEntry entry = userTable.removeUser(engineID, userName); if (entry != null) { fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_REMOVED)); return entry.getUsmUser(); } return null; }
/** * Removes an USM user from the internal user name table. * @param engineID * the authoritative engine ID associated with the user, or * {@code null} * @param userName * a user name. * @return * the removed {@code UsmUser} instance associate with the given * {@code userName} or {@code null} if such a user could not * be found. * @deprecated * If the engineID {@code null} is provided this method does only * delete the generic user. All already localized users will not be deleted. * To delete those users too, use {@link #removeAllUsers()} instead. */ public UsmUser removeUser(OctetString engineID, OctetString userName) { UsmUserEntry entry = userTable.removeUser(engineID, userName); if (entry != null) { fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_REMOVED)); return entry.getUsmUser(); } return null; }
/** * Adds a localized user to the USM. * @param engineID * the engine ID for which the user has been localized. * @param userName * the user's name. * @param authProtocol * the authentication protocol ID. * @param authKey * the authentication key. * @param privProtocol * the privacy protocol ID. * @param privKey * the privacy key. * @return * the added <code>UsmUserEntry</code>. */ public UsmUserEntry addLocalizedUser(byte[] engineID, OctetString userName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) { UsmUserEntry newEntry = new UsmUserEntry(engineID, userName, authProtocol, authKey, privProtocol, privKey); userTable.addUser(newEntry); fireUsmUserChange(new UsmUserEvent(this, newEntry, UsmUserEvent.USER_ADDED)); return newEntry; }
/** * Adds a localized user to the USM. * * @param engineID * the engine ID for which the user has been localized. * @param userName * the user's name. * @param authProtocol * the authentication protocol ID. * @param authKey * the authentication key. * @param privProtocol * the privacy protocol ID. * @param privKey * the privacy key. * * @return the added {@code UsmUserEntry}. */ public UsmUserEntry addLocalizedUser(byte[] engineID, OctetString userName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) { UsmUserEntry newEntry = new UsmUserEntry(engineID, userName, authProtocol, authKey, privProtocol, privKey); userTable.addUser(newEntry); fireUsmUserChange(new UsmUserEvent(this, newEntry, UsmUserEvent.USER_ADDED)); return newEntry; }
/** * Adds a localized user to the USM. * @param engineID * the engine ID for which the user has been localized. * @param userName * the user's name. * @param authProtocol * the authentication protocol ID. * @param authKey * the authentication key. * @param privProtocol * the privacy protocol ID. * @param privKey * the privacy key. * @return * the added {@code UsmUserEntry}. */ public UsmUserEntry addLocalizedUser(byte[] engineID, OctetString userName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) { UsmUserEntry newEntry = new UsmUserEntry(engineID, userName, authProtocol, authKey, privProtocol, privKey); userTable.addUser(newEntry); fireUsmUserChange(new UsmUserEvent(this, newEntry, UsmUserEvent.USER_ADDED)); return newEntry; }
/** * Updates the USM user entry with the same engine ID and user name as the * supplied instance and fires an appropriate {@code UsmUserEvent}. * If the corresponding user entry does not yet exist then it will be added. * @param entry * an {@code UsmUserEntry} instance not necessarily the same as an * already existing entry. * @since 1.2 */ public void updateUser(UsmUserEntry entry) { UsmUserEntry oldEntry = userTable.addUser(entry); if (oldEntry != null) { entry.setStorageType(oldEntry.getStorageType()); } fireUsmUserChange(new UsmUserEvent(this, entry, (oldEntry == null) ? UsmUserEvent.USER_ADDED: UsmUserEvent.USER_CHANGED)); }
/** * Updates the USM user entry with the same engine ID and user name as the * supplied instance and fires an appropriate {@code UsmUserEvent}. * If the corresponding user entry does not yet exist then it will be added. * * @param entry * an {@code UsmUserEntry} instance not necessarily the same as an * already existing entry. * * @since 1.2 */ public void updateUser(UsmUserEntry entry) { UsmUserEntry oldEntry = userTable.addUser(entry); if (oldEntry != null) { entry.setStorageType(oldEntry.getStorageType()); } fireUsmUserChange(new UsmUserEvent(this, entry, (oldEntry == null) ? UsmUserEvent.USER_ADDED : UsmUserEvent.USER_CHANGED)); }
entry.setPrivacyKey(privKey); userTable.addUser(entry); fireUsmUserChange(new UsmUserEvent(this, entry, UsmUserEvent.USER_ADDED));