From bdec01e02d0790e0e5cb9b635bd200bd2ed0312b Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Mon, 09 Oct 2006 12:54:14 +0000
Subject: [PATCH] Update the JMX connection handler to ensure that it invokes the post-connect plugins at the appropriate time. Update the JMX client connection to ensure that it invokes the post-disconnect plugins at the appropriate time.  Add unit-test to check that post-connect and post-disconnect plugins are called.

---
 opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java b/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
index 7cfab8a..16d02cf 100644
--- a/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
+++ b/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
@@ -31,7 +31,10 @@
 import javax.management.remote.JMXAuthenticator;
 import javax.security.auth.Subject;
 
+import org.opends.server.api.plugin.PostConnectPluginResult;
 import org.opends.server.core.BindOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.PluginConfigManager;
 import org.opends.server.messages.CoreMessages;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.protocols.ldap.LDAPException;
@@ -195,7 +198,17 @@
 
     //
     // If we've gotten here, then the authentication was
-    // successful.
+    // successful. We'll take the connection so
+    // invoke the post-connect plugins.
+    PluginConfigManager pluginManager = DirectoryServer
+        .getPluginConfigManager();
+    PostConnectPluginResult pluginResult = pluginManager
+        .invokePostConnectPlugins(jmxClientConnection);
+    if (pluginResult.connectionTerminated())
+    {
+      SecurityException se = new SecurityException(pluginResult.toString());
+      throw se;
+    }
 
     // initialize a subject
     Subject s = new Subject();

--
Gitblit v1.10.0