< prev index next >
src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java
Print this page
@@ -89,14 +89,16 @@
*/
public JMXPluggableAuthenticator(Map<?, ?> env) {
String loginConfigName = null;
String passwordFile = null;
+ String hashPasswords = null;
if (env != null) {
loginConfigName = (String) env.get(LOGIN_CONFIG_PROP);
passwordFile = (String) env.get(PASSWORD_FILE_PROP);
+ hashPasswords = (String) env.get(HASH_PASSWORDS);
}
try {
if (loginConfigName != null) {
@@ -112,19 +114,20 @@
new AuthPermission("createLoginContext." +
LOGIN_CONFIG_NAME));
}
final String pf = passwordFile;
+ final String hashPass = hashPasswords;
try {
loginContext = AccessController.doPrivileged(
new PrivilegedExceptionAction<LoginContext>() {
public LoginContext run() throws LoginException {
return new LoginContext(
LOGIN_CONFIG_NAME,
null,
new JMXCallbackHandler(),
- new FileLoginConfig(pf));
+ new FileLoginConfig(pf,hashPass));
}
});
} catch (PrivilegedActionException pae) {
throw (LoginException) pae.getException();
}
@@ -248,10 +251,12 @@
private static final String LOGIN_CONFIG_PROP =
"jmx.remote.x.login.config";
private static final String LOGIN_CONFIG_NAME = "JMXPluggableAuthenticator";
private static final String PASSWORD_FILE_PROP =
"jmx.remote.x.password.file";
+ private static final String HASH_PASSWORDS =
+ "jmx.remote.x.password.file.hash";
private static final ClassLogger logger =
new ClassLogger("javax.management.remote.misc", LOGIN_CONFIG_NAME);
/**
* This callback handler supplies the username and password (which was
@@ -301,23 +306,25 @@
private static final String FILE_LOGIN_MODULE =
FileLoginModule.class.getName();
// The option that identifies the password file to use
private static final String PASSWORD_FILE_OPTION = "passwordFile";
+ private static final String HASH_PASSWORDS = "hashPassword";
/**
* Creates an instance of <code>FileLoginConfig</code>
*
* @param passwordFile A filepath that identifies the password file to use.
* If null then the default password file is used.
*/
- public FileLoginConfig(String passwordFile) {
+ public FileLoginConfig(String passwordFile, String hashPasswords) {
Map<String, String> options;
if (passwordFile != null) {
options = new HashMap<String, String>(1);
options.put(PASSWORD_FILE_OPTION, passwordFile);
+ options.put(HASH_PASSWORDS, hashPasswords);
} else {
options = Collections.emptyMap();
}
entries = new AppConfigurationEntry[] {
< prev index next >