Package org.openjdk.jmc.common.security
Interface ISecurityManager
public interface ISecurityManager
This is the interface for the security manager used by Mission Control. It may seem like a
security breach to use Strings for passwords (some may be concerned that they remain in the
system, since they are immutable and can not be cleared in the same manner as for instance a char
array). However, since the credentials must be made into strings to be passed into the JMX
environment when establishing a connection I may as well use strings to make the API simpler to
use.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Triggers a change of the master password.void
clearFamily
(String family, Set<String> keys) When the store is accessible, all objects belonging tofamily
that is not identified bykeys
will be removedReturns a stored objectboolean
boolean
isLocked()
void
setEncryptionCipher
(String encryptionCipher) Sets the encryption ciphers to use.store
(byte... value) storeInFamily
(String family, byte... value) storeInFamily
(String family, String... value) void
storeWithKey
(String key, byte... value) void
storeWithKey
(String key, String... value) void
unlock()
Unlocks the storage if it is lockedReturns a stored object and removes it from the security manager
-
Method Details
-
withdraw
Returns a stored object and removes it from the security manager- Parameters:
key
- the key of the stored object- Returns:
- the stored value, or null if the store is locked. Will be a String[] or a byte[] depending on which store method it was inserted with.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
clearFamily
When the store is accessible, all objects belonging tofamily
that is not identified bykeys
will be removed- Parameters:
family
- the family to clearkeys
- the keys of the objects to keep- Throws:
FailedToSaveException
-
get
Returns a stored object- Parameters:
key
- the key of the stored object- Returns:
- the stored value. Will be a String[] or a byte[] depending on which store method it was inserted with.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
storeWithKey
- Parameters:
key
- the key of the objectvalue
- the value to store secure.- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
storeWithKey
- Parameters:
key
- the key of the objectvalue
- the value to store secure.- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
storeInFamily
- Parameters:
family
- the family to which the object belongs.value
- the value to store secure.- Returns:
- the key of the stored object.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
storeInFamily
- Parameters:
family
- the family to which the object belongs.value
- the value to store secure.- Returns:
- the key of the stored object.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
store
- Parameters:
value
- the value to store secure.- Returns:
- the key of the stored object.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
store
- Parameters:
value
- the value to store secure.- Returns:
- the key of the stored object.
- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems.
-
unlock
Unlocks the storage if it is locked- Throws:
ActionNotGrantedException
- if the master password was not given.
-
isLocked
boolean isLocked()- Returns:
- true if the store is locked, false otherwise.
-
hasKey
- Parameters:
key
- the key of the stored object- Returns:
- true if the key exists, false otherwise.
-
getEncryptionCiphers
- Returns:
- the supported encryption ciphers.
-
getEncryptionCipher
String getEncryptionCipher()- Returns:
- the currently used encryption cipher.
-
setEncryptionCipher
Sets the encryption ciphers to use.- Parameters:
encryptionCipher
- the encryption cipher to use.- Throws:
SecurityException
- for security problems, e.g. provided cipher is not available.
-
changeMasterPassword
Triggers a change of the master password.- Throws:
ActionNotGrantedException
- if the master password was not given.SecurityException
- for other security problems. e.g. provided cipher is not available.
-