java.lang.Object
org.snmp4j.security.UsmUserEntry
- All Implemented Interfaces:
Serializable,Comparable<UsmUserEntry>
The
UsmUserEntry class represents a user in the Local Configuration Datastore (LCD).
The embedded UsmUser can be localized for an engine ID or not. The localization state is
determined by UsmUser.isLocalized().
Adding a non-localized user to the LCD does only makes sense if (1) USM.isEngineDiscoveryEnabled() is true
and this user should be used to access command responders without yet unknown engine ID or if (2) this user should
be used to receive incoming notifications from agents with (yet) unknown authoritative engine IDs.
If a user can be used for discoveries of type (1) and/or (2), then it can be defined by
UsmUserEntry(OctetString, UsmUser). Otherwise a constructor wit authoritative engine ID must be
used.- Version:
- 3.8.0
- Author:
- Frank Fock
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new user entry with empty engine ID and empty user.UsmUserEntry(byte[] engineID, OctetString securityName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) Creates a localized user entry.UsmUserEntry(OctetString userName, UsmUser user) Creates a user with username and associatedUsmUser.UsmUserEntry(OctetString userName, OctetString engineID, UsmUser user) Creates a user with username and associatedUsmUser. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(UsmUserEntry other) Compares this user entry with another one by engine ID then by their user names.byte[]Gets the owner of this user entry (if set).byte[]voidsetAuthenticationKey(byte[] authenticationKey) voidsetEngineID(OctetString engineID) voidsetOwnerReference(Object ownerReference) Sets the (weak) owner reference of this user entry.voidsetPrivacyKey(byte[] privacyKey) voidsetStorageType(SnmpConstants.StorageTypeEnum storageType) voidsetUserName(OctetString userName) voidsetUsmUser(UsmUser usmUser) toString()
-
Constructor Details
-
UsmUserEntry
public UsmUserEntry()Creates a new user entry with empty engine ID and empty user. -
UsmUserEntry
Creates a user with username and associatedUsmUser.- Parameters:
userName- the username of the new entry.user- theUsmUserrepresenting the security information of the user.
-
UsmUserEntry
Creates a user with username and associatedUsmUser.- Parameters:
userName- the username of the new entry.engineID- the authoritative engine ID associated with the user.user- theUsmUserrepresenting the security information of the user.
-
UsmUserEntry
public UsmUserEntry(byte[] engineID, OctetString securityName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) Creates a localized user entry.- Parameters:
engineID- the engine ID for which the user has been localized.securityName- the user and security name of the new entry.authProtocol- the authentication protocol ID.authKey- the authentication key.privProtocol- the privacy protocol ID.privKey- the privacy key.
-
-
Method Details
-
getEngineID
-
setEngineID
-
setUserName
-
getUserName
-
setUsmUser
-
getUsmUser
-
setAuthenticationKey
public void setAuthenticationKey(byte[] authenticationKey) -
getAuthenticationKey
public byte[] getAuthenticationKey() -
setPrivacyKey
public void setPrivacyKey(byte[] privacyKey) -
getPrivacyKey
public byte[] getPrivacyKey() -
compareTo
Compares this user entry with another one by engine ID then by their user names.- Specified by:
compareToin interfaceComparable<UsmUserEntry>- Parameters:
other- aUsmUserEntryinstance.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
getStorageType
-
setStorageType
-
getOwnerReference
Gets the owner of this user entry (if set).- Returns:
- an object previously set by
setOwnerReference(Object)ornull(default). - Since:
- 3.6.3
-
setOwnerReference
Sets the (weak) owner reference of this user entry. If the owner is deleted, this reference disappears andgetOwnerReference()returnsnull.- Parameters:
ownerReference- an object identifying itself as owner of this entry (i.e. this object may ignoreUsmUserEvents of this object while this reference is present.- Since:
- 3.6.3
-
toString
-