public class JMXPasswordAuthenticator extends Object implements JMXAuthenticator
This class represents a username/password based implementation of
the JMXAuthenticator interface.
The set of username/password pairs is passed either as a
filename which denotes a properties file on disk, or directly as an
instance of the Properties class. In both cases, the name
of each property represents a username, and the value of the
property is the associated password. Thus, any given username
either does not exist in the properties or has exactly one
password. The same password can be shared by several
usernames.
If authentication is successful then an authenticated Subject
filled in with a JMXPrincipal is returned. Authorization checks
will then be performed based on this Subject.
| Constructor and Description |
|---|
JMXPasswordAuthenticator(Properties pwProps)
Creates an instance of
JMXPasswordAuthenticator
and initializes it from the specified properties instance. |
JMXPasswordAuthenticator(String pwFile)
Creates an instance of
JMXPasswordAuthenticator
and initializes it from the specified properties file. |
| Modifier and Type | Method and Description |
|---|---|
Subject |
authenticate(Object credentials)
Authenticate the
MBeanServerConnection client
with the given client credentials. |
void |
refresh()
Refresh the set of username/password entries.
|
public JMXPasswordAuthenticator(String pwFile) throws IOException
JMXPasswordAuthenticator
and initializes it from the specified properties file.pwFile - name of the file which denotes a properties
file on disk containing the username/password entries.IOException - if the file does not exist, is a
directory rather than a regular file, or for some other
reason cannot be opened for reading.public JMXPasswordAuthenticator(Properties pwProps)
JMXPasswordAuthenticator
and initializes it from the specified properties instance.
This constructor makes a copy of the properties instance using
its clone method and it is the copy that is
consulted to check the username and password of an incoming
connection. The original properties object can be modified
without affecting the copy. If the refresh() method is
then called, the authenticator will make a new copy of the
properties object at that time.pwProps - properties list containing the username/password
entries.IllegalArgumentException - if pwProps is
null.public Subject authenticate(Object credentials)
MBeanServerConnection client
with the given client credentials.authenticate in interface JMXAuthenticatorcredentials - the user-defined credentials to be passed in
to the server in order to authenticate the user before creating
the MBeanServerConnection. This parameter must
be a two-element String[] containing the client's
username and password in that order.JMXPrincipal(username).SecurityException - if the server cannot authenticate the user
with the provided credentials.public void refresh()
throws IOException
Refresh the set of username/password entries.
If this instance was created using the JMXPasswordAuthenticator(String) constructor to specify a
file from which the entries are read, the file is re-read.
If this instance was created using the
JMXPasswordAuthenticator(Properties) constructor
then a new copy of the Properties object is made.
IOException - if the file does not exist, is a
directory rather than a regular file, or for some other
reason cannot be opened for reading.Copyright © 2019 Terracotta, Inc.. All rights reserved.