public class PasswordFile extends Object
asadmin
--passwordfile
file format.
asadmin
--passwordfile
argument specifies the name,
including the full path, of a file that contains password entries in
a specific format.
Note that any password file created to pass as an argument by using
the --passwordfile
option should be protected with file system
permissions. Additionally, any password file being used for a
transient purpose, such as setting up SSH among nodes, should be
deleted after it has served its purpose.
The entry for a password must have the AS_ADMIN_ prefix followed by
the password name in uppercase letters, an equals sign, and the
password.
The entries in the file that are read by the asadmin utility are as
follows:
AS_ADMIN_PASSWORD=administration-password
AS_ADMIN_MASTERPASSWORD=master-password
AS_ADMIN_NEWPASSWORD=new-administration-password
(read by
the start-domain
subcommand)AS_ADMIN_USERPASSWORD=user-password
(read by the
create-file-user
subcommand)AS_ADMIN_ALIASPASSWORD=alias-password
(read by the
create-password-alias
subcommand)AS_ADMIN_MAPPEDPASSWORD=mapped-password
(read by the
create-connector-security-map
subcommand)AS_ADMIN_WINDOWSPASSWORD=windows-password
(read by the
create-node-dcom
, install-node-dcom
, and
update-node-dcom
subcommands)AS_ADMIN_SSHPASSWORD=sshd-password
(read by the
create-node-ssh
, install-node
,
install-node-ssh
, and update-node-ssh
subcommands)AS_ADMIN_SSHKEYPASSPHRASE=sshd-passphrase
(read by the
create-node-ssh
, install-node
,
install-node-ssh
, and update-node-ssh
subcommands)AS_ADMIN_JMSDBPASSWORD=jdbc-user-password
(read by the
configure-jms-cluster
subcommand)AS_ADMIN_password-name=${ALIAS=password-alias-name}
For example:
AS_ADMIN_SSHPASSWORD=${ALIAS=ssh-password-alias}
AS_ADMIN_SSHKEYPASSPHRASE=${ALIAS=ssh-key-passphrase-alias}
Modifier and Type | Field and Description |
---|---|
private String |
adminNewPassword
New administrator password to be set (optional).
|
private String |
adminPassword
Administrator password value (mandatory).
|
private static String |
AS_ADMIN_MASTERPASSWORD
Master password key (optional).
|
private static String |
AS_ADMIN_NEWPASSWORD
New administrator password to be set (optional).
|
private static String |
AS_ADMIN_PASSWORD
Administrator password key (mandatory).
|
private static char |
ASSIGN_VALUE
Key to value assignment character.
|
private static Set<PosixFilePermission> |
CREATE_FILE_PERMISSIONS
Password file permissions when file is being created before writing
it's content.
|
(package private) Path |
file
Password file path.
|
private static Set<PosixFilePermission> |
FINAL_FILE_PERMISSIONS
Password file permissions when file is finished.
|
private static Logger |
LOGGER
Logger instance for this class.
|
private String |
masterPassword
Master password value (optional).
|
static String |
PASSWORD_FILE_NAME
Name of password file.
|
Constructor and Description |
---|
PasswordFile(GlassFishServer server)
Constructs an instance of Support for
asadmin
--passwordfile file format. |
Modifier and Type | Method and Description |
---|---|
static Path |
buildPasswordFilePath(GlassFishServer server) |
private boolean |
createFilePosix()
Create password file to be written with access permissions to read
and write by user only.
|
private String |
dataToWrite()
Build password file content to be written into file.
|
private boolean |
finishFilePosix()
Update password file permissions when finished.
|
String |
getAdminNewPassword()
Get new administrator password to be set (optional).
|
String |
getAdminPassword()
Get administrator password value (mandatory).
|
String |
getFilePath()
Get password file path as
String . |
String |
getMasterPassword()
Get master password value (optional).
|
void |
setAdminNewPassword(String adminNewPassword)
Get new administrator password to be set (optional).
|
void |
setAdminPassword(String adminPassword)
Get administrator password value (mandatory).
|
void |
setMasterPassword(String masterPassword)
Get master password value (optional).
|
boolean |
write()
Write GlassFish password file using stored values.
|
private static final Logger LOGGER
public static final String PASSWORD_FILE_NAME
private static final Set<PosixFilePermission> CREATE_FILE_PERMISSIONS
private static final Set<PosixFilePermission> FINAL_FILE_PERMISSIONS
private static final char ASSIGN_VALUE
private static final String AS_ADMIN_PASSWORD
private static final String AS_ADMIN_MASTERPASSWORD
private static final String AS_ADMIN_NEWPASSWORD
Path file
private String adminPassword
private String masterPassword
private String adminNewPassword
PasswordFile(GlassFishServer server)
asadmin
--passwordfile
file format.
Content of password file is not read from file so at least administrator
password from GlassFishServer
must be provided.
server
- GlassFish server instance.public static Path buildPasswordFilePath(GlassFishServer server)
public String getAdminPassword()
public void setAdminPassword(String adminPassword)
adminPassword
- Administrator password value (mandatory).public String getMasterPassword()
public void setMasterPassword(String masterPassword)
masterPassword
- Master password value (optional).public String getAdminNewPassword()
public void setAdminNewPassword(String adminNewPassword)
adminNewPassword
- New administrator password to be set (optional).private String dataToWrite()
private boolean createFilePosix()
true
if new file was created
or false
otherwiseprivate boolean finishFilePosix()
public boolean write()
true
when file was successfully written
or false
otherwise.Copyright © 2013. All Rights Reserved.