/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5025141
* @summary Tests that MBeanServerFileAccessController supports
* principals other than JMXPrincipal.
* @author Luis-Miguel Alventosa
* @run clean NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
* @run build NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
* @run main NonJMXPrincipalsTest
*/
public class NonJMXPrincipalsTest {
throw new NullPointerException("illegal null input");
}
return name;
}
return("OtherPrincipal: " + name);
}
if (o == null)
return false;
if (this == o)
return true;
if (!(o instanceof OtherPrincipal))
return false;
}
public int hashCode() {
}
}
private static class OtherPrincipalAuthenticator
implements JMXAuthenticator {
return subject;
}
}
private static class NoPrincipalAuthenticator
implements JMXAuthenticator {
return new Subject();
}
}
throws Exception {
//------------------------------------------------------------------
// SERVER
//------------------------------------------------------------------
// Instantiate the MBean server
//
// Create SimpleStandard MBean
//
// Server's environment map
//
// Provide a JMX Authenticator
//
// Provide the access level file used by the connector server to
// perform user authorization. The access level file is a properties
// access level is either "readonly" or "readwrite" access to the
// MBeanServer operations. This properties based access control
// checker has been implemented using the MBeanServerForwarder
// interface which wraps the real MBean server inside an access
// controller MBean server which performs the access control checks
// before forwarding the requests to the real MBean server.
//
// This property is implementation-dependent and might not be
// supported by all implementations of the JMX Remote API.
//
// Create an RMI connector server
//
// Start the RMI connector server
//
//------------------------------------------------------------------
// CLIENT (admin)
//------------------------------------------------------------------
// Admin client environment map
//
// Create an RMI connector client and
// connect it to the RMI connector server
//
"connect it to the RMI connector server");
// Get an MBeanServerConnection
//
// Get the proxy for the Simple MBean
//
SimpleStandardMBean.class,
false);
// Get State attribute
//
// Set State attribute
//
// Get State attribute
//
// Invoke "reset" in SimpleStandard MBean
//
adminProxy.reset();
// Close MBeanServer connection
//
//------------------------------------------------------------------
// CLIENT (user)
//------------------------------------------------------------------
// User client environment map
//
// Create an RMI connector client and
// connect it to the RMI connector server
//
"connect it to the RMI connector server");
// Get an MBeanServerConnection
//
// Get the proxy for the Simple MBean
//
SimpleStandardMBean.class,
false);
// Get State attribute
//
// Set State attribute
//
try {
} catch (SecurityException e) {
} catch (Exception e) {
}
// Get State attribute
//
// Invoke "reset" in SimpleStandard MBean
//
try {
} catch (SecurityException e) {
} catch (Exception e) {
}
// Close MBeanServer connection
//
//------------------------------------------------------------------
// SERVER
//------------------------------------------------------------------
// Stop the connector server
//
}
int errorCount = 0;
// Runt tests
//
try {
errorCount++;
} catch (Exception e) {
if (e instanceof SecurityException) {
} else {
errorCount++;
}
}
try {
} catch (Exception e) {
errorCount++;
}
if (errorCount > 0) {
}
}
}