JGroups AUTH handler in Clustering Services 57/1457/1 topic/codeshare/of1.3
authorMadhu Venugopal <vmadhu@cisco.com>
Fri, 27 Sep 2013 12:48:38 +0000 (05:48 -0700)
committerMadhu Venugopal <vmadhu@cisco.com>
Fri, 27 Sep 2013 12:48:38 +0000 (05:48 -0700)
It is possible to add Jgroups AUTH as part of the protocol stack below infinispan if the deployment requires
more secured clustered controllers. Failing on such Authentication must be treated critical and the controller
must exit.

Change-Id: Ifa2b5cb2588b82038dcd6fcf7785a48ae2af8bf4
Signed-off-by: Madhu Venugopal <vmadhu@cisco.com>
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManager.java

index 122063abba0e3c92ad38c2af28a6a9e72f1dcf86..518bf7b1a84f9742e589dd37d21432e6ee42dcb0 100644 (file)
@@ -236,6 +236,17 @@ public class ClusterManager implements IClusterServices {
         return res;
     }
 
+    private void exitOnSecurityException(Exception ioe) {
+        Throwable cause = ioe.getCause();
+        while (cause != null) {
+            if (cause instanceof java.lang.SecurityException) {
+                logger.error("Failed Cluster authentication. Stopping Controller...");
+                System.exit(0);
+            }
+            cause = cause.getCause();
+        }
+    }
+
     public void start() {
         this.gossiper = startGossiper();
         if (this.gossiper != null) {
@@ -272,6 +283,7 @@ public class ClusterManager implements IClusterServices {
             logger.error("Stack Trace that raised th exception");
             logger.error("",ioe);
             this.cm = null;
+            exitOnSecurityException(ioe);
             this.stop();
         }
         logger.debug("Cache Manager has value {}", this.cm);