You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ag...@apache.org on 2016/05/03 23:45:47 UTC

[33/60] [abbrv] incubator-geode git commit: GEODE-17: review changes

GEODE-17: review changes


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3d8f54c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3d8f54c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3d8f54c9

Branch: refs/heads/feature/GEODE-1209
Commit: 3d8f54c9827ed308696ae44481a3705ca6e52c54
Parents: 165c9bc
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Apr 28 09:38:12 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Apr 28 11:21:09 2016 -0700

----------------------------------------------------------------------
 .../internal/security/AuthorizeRequest.java        | 17 -----------------
 .../internal/security/MBeanServerWrapper.java      |  4 ++--
 .../com/gemstone/gemfire/security/ShiroUtil.java   | 10 +++++++---
 3 files changed, 9 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d8f54c9/geode-core/src/main/java/com/gemstone/gemfire/internal/security/AuthorizeRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/AuthorizeRequest.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/AuthorizeRequest.java
index 7981ccb..9ec7578 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/AuthorizeRequest.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/AuthorizeRequest.java
@@ -95,23 +95,6 @@ public class AuthorizeRequest {
         new Object[] {id, authzFactoryName});
     }
   }
- 
-  public AccessControl getAuthzCallback() {
-
-    return this.authzCallback;
-  }
-
-  public Principal getPrincipal() {
-    return principal;
-  }
-
-  public boolean isPrincipalSerializable() {
-    return isPrincipalSerializable;
-  }
-
-  public LogWriterI18n getLogger() {
-    return logger;
-  }
 
   public GetOperationContext getAuthorize(String regionName, Object key,
       Object callbackArg) throws NotAuthorizedException {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d8f54c9/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
index c7cb058..bbc0442 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/MBeanServerWrapper.java
@@ -207,7 +207,7 @@ public class MBeanServerWrapper implements MBeanServerForwarder {
       try {
         setAttribute(name, attribute);
       } catch (Exception e) {
-        throw new GemFireSecurityException("error setting attribute "+attribute+" of "+name);
+        throw new GemFireSecurityException("error setting attribute "+attribute+" of "+name, e);
       }
     }
     return attributes;
@@ -237,7 +237,7 @@ public class MBeanServerWrapper implements MBeanServerForwarder {
     try {
       beanInfo = mbs.getMBeanInfo(objectName);
     } catch (IntrospectionException e) {
-      throw new GemFireSecurityException("error getting beanInfo of "+objectName);
+      throw new GemFireSecurityException("error getting beanInfo of "+objectName, e);
     }
     // If there is no annotation defined either in the class level or method level, we should consider this operation/attribute freely accessible
     ResourceOperationContext result = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3d8f54c9/geode-core/src/main/java/com/gemstone/gemfire/security/ShiroUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/ShiroUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/security/ShiroUtil.java
index 5eedaf4..01914e4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/ShiroUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/ShiroUtil.java
@@ -22,6 +22,8 @@ import java.util.concurrent.Callable;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
 import com.gemstone.gemfire.management.internal.security.ResourceOperationContext;
+
+import org.apache.logging.log4j.Logger;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.ShiroException;
 import org.apache.shiro.UnavailableSecurityManagerException;
@@ -31,6 +33,8 @@ import org.apache.shiro.util.ThreadContext;
 
 public class ShiroUtil {
 
+  private static Logger logger = LogService.getLogger();
+
   public static void login(String username, String password){
     if(!isShiroConfigured())
       return;
@@ -40,7 +44,7 @@ public class ShiroUtil {
     UsernamePasswordToken token =
         new UsernamePasswordToken(username, password);
     try {
-      LogService.getLogger().info("Logging in "+username+"/"+password);
+      logger.info("Logging in "+username+"/"+password);
       currentUser.login(token);
     } catch (ShiroException e) {
       throw new AuthenticationFailedException(e.getMessage(), e);
@@ -53,7 +57,7 @@ public class ShiroUtil {
 
     Subject currentUser = SecurityUtils.getSubject();
     try {
-      LogService.getLogger().info("Logging out "+currentUser.getPrincipal());
+      logger.info("Logging out "+currentUser.getPrincipal());
       currentUser.logout();
     }
     catch(ShiroException e){
@@ -93,7 +97,7 @@ public class ShiroUtil {
       currentUser.checkPermission(permission);
     }
     catch(ShiroException e){
-      LogService.getLogger().info(currentUser.getPrincipal() + " not authorized for "+resource+":"+operation+":"+regionName);
+      logger.info(currentUser.getPrincipal() + " not authorized for "+resource+":"+operation+":"+regionName);
       throw new GemFireSecurityException(e.getMessage(), e);
     }
   }