javax.management.remote.JMXAuthenticator Java Examples
The following examples show how to use
javax.management.remote.JMXAuthenticator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectorBootstrap.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #2
Source File: ConnectorBootstrap.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #3
Source File: ConnectorBootstrap.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #4
Source File: Server.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public static void main(String[] args) throws Exception { prepareUsersFile(); // The address of the connector server JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx"); // Specify the authenticator in the environment Map, using the // standard property JMXConnector.AUTHENTICATOR Map environment = new HashMap(); JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE)); environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator); // Create and register the connector server JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null); ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol()); MBeanServer server = MBeanServerFactory.createMBeanServer("remote.security.example"); server.registerMBean(cntorServer, cntorServerName); // Setup the rmiregistry to bind in JNDI the RMIConnectorServer stub. NamingService naming = new NamingService(); ObjectName namingName = ObjectName.getInstance(":service=" + NamingService.class.getName()); server.registerMBean(naming, namingName); naming.start(); // Setup the interception SubjectTrackingMBeanServer interceptor = new SubjectTrackingMBeanServer(); cntorServer.setMBeanServerForwarder(interceptor); // Start the connector server cntorServer.start(); System.out.println("Server up and running"); }
Example #5
Source File: Server.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public static void main(String[] args) throws Exception { prepareUsersFile(); // The address of the connector server JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx"); // Specify the authenticator in the environment Map, using the // standard property JMXConnector.AUTHENTICATOR Map environment = new HashMap(); JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE)); environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator); // Create and register the connector server JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null); ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol()); MBeanServer server = MBeanServerFactory.createMBeanServer("remote.security.example"); server.registerMBean(cntorServer, cntorServerName); // Setup the rmiregistry to bind in JNDI the RMIConnectorServer stub. NamingService naming = new NamingService(); ObjectName namingName = ObjectName.getInstance(":service=" + NamingService.class.getName()); server.registerMBean(naming, namingName); naming.start(); // Start the connector server cntorServer.start(); System.out.println("Server up and running"); }
Example #6
Source File: ConnectorBootstrap.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #7
Source File: ConnectorBootstrap.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #8
Source File: ConnectorBootstrap.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #9
Source File: ConnectorBootstrap.java From hottub with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #10
Source File: ConnectorBootstrap.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #11
Source File: ConnectorBootstrap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #12
Source File: ConnectorBootstrap.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #13
Source File: ConnectorBootstrap.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #14
Source File: JMXMessageReader.java From JPPF with Apache License 2.0 | 5 votes |
/** * Handle a connection reqUest. * @param context the JMX nio context. * @param request the connection request to handle. * @return the connection ID. * @throws Exception if any error occurs. */ private static String handleConnect(final JMXContext context, final JMXRequest request) throws Exception { final JMXAuthenticator authenticator = context.getChannels().getAuthenticator(); if (authenticator != null) { final Subject subject = authenticator.authenticate(request.getParams()[0]); context.getChannels().setSubject(subject); final JMXAuthorizationChecker checker = context.getChannels().getAuhtorizationChecker(); if (checker != null) checker.setSubject(subject); } return context.getConnectionID(); }
Example #15
Source File: ConnectorBootstrap.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #16
Source File: ConnectorBootstrap.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public Subject authenticate(Object credentials) { final JMXAuthenticator authenticator = new JMXPluggableAuthenticator(environment); final Subject subject = authenticator.authenticate(credentials); checkAccessFileEntries(subject); return subject; }
Example #17
Source File: JMXManager.java From Openfire with Apache License 2.0 | 4 votes |
private void start() { setContainer(new MBeanContainer(ManagementFactory.getPlatformMBeanServer())); int jmxPort = JMXManager.getPort(); String jmxUrl = "/jndi/rmi://localhost:" + jmxPort + "/jmxrmi"; Map<String, Object> env = new HashMap<>(); if (JMXManager.isSecure()) { env.put("jmx.remote.authenticator", new JMXAuthenticator() { @Override public Subject authenticate(Object credentials) { if (!(credentials instanceof String[])) { if (credentials == null) { throw new SecurityException("Credentials required"); } throw new SecurityException("Credentials should be String[]"); } final String[] aCredentials = (String[]) credentials; if (aCredentials.length < 2) { throw new SecurityException("Credentials should have at least two elements"); } String username = aCredentials[0]; String password = aCredentials[1]; try { AuthFactory.authenticate(username, password); } catch (Exception ex) { Log.error("Authentication failed for " + username); throw new SecurityException(); } if (AdminManager.getInstance().isUserAdmin(username, true)) { return new Subject(true, Collections.singleton(new JMXPrincipal(username)), Collections.EMPTY_SET, Collections.EMPTY_SET); } else { Log.error("Authorization failed for " + username); throw new SecurityException(); } } }); } try { jmxServer = new ConnectorServer(new JMXServiceURL("rmi", null, jmxPort, jmxUrl), env, "org.eclipse.jetty.jmx:name=rmiconnectorserver"); jmxServer.start(); } catch (Exception e) { Log.error("Failed to start JMX connector", e); } }