You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/07/08 15:51:56 UTC

[36/50] [abbrv] incubator-geode git commit: GEODE-1571: rename IntegratedSecurity to SecurityManager

GEODE-1571: rename IntegratedSecurity to SecurityManager


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

Branch: refs/heads/develop
Commit: 2f841f67977e8ed6f5e7211d3ed1e5d7c5e42cbf
Parents: 8f50940
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue Jul 5 13:59:43 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Tue Jul 5 13:59:43 2016 -0700

----------------------------------------------------------------------
 .../internal/security/GeodeSecurityUtil.java    | 15 +++++----
 .../security/shiro/CustomAuthRealm.java         | 12 ++++----
 .../gemfire/security/IntegratedSecurity.java    | 32 --------------------
 .../gemfire/security/SecurityManager.java       | 32 ++++++++++++++++++++
 .../templates/SampleJsonAuthorization.java      |  4 +--
 5 files changed, 47 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2f841f67/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index 20507c7..ce7eff3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -35,7 +35,6 @@ import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.config.Ini.Section;
 import org.apache.shiro.config.IniSecurityManagerFactory;
 import org.apache.shiro.mgt.DefaultSecurityManager;
-import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.realm.Realm;
 import org.apache.shiro.subject.Subject;
 import org.apache.shiro.subject.support.SubjectThreadState;
@@ -49,7 +48,7 @@ import com.gemstone.gemfire.internal.security.shiro.ShiroPrincipal;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
-import com.gemstone.gemfire.security.IntegratedSecurity;
+import com.gemstone.gemfire.security.SecurityManager;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.GeodePermission;
 import com.gemstone.gemfire.security.GeodePermission.Operation;
@@ -309,16 +308,16 @@ public class GeodeSecurityUtil {
         main.put("iniRealm.permissionResolver", "$geodePermissionResolver");
       }
 
-      SecurityManager securityManager = factory.getInstance();
+      org.apache.shiro.mgt.SecurityManager securityManager = factory.getInstance();
       SecurityUtils.setSecurityManager(securityManager);
     }
 
-    // only set up shiro realm if user has implemented IntegratedSecurity
-    else if (authenticatorObject != null && authenticatorObject instanceof IntegratedSecurity) {
-      IntegratedSecurity authenticator = (IntegratedSecurity) authenticatorObject;
+    // only set up shiro realm if user has implemented SecurityManager
+    else if (authenticatorObject != null && authenticatorObject instanceof SecurityManager) {
+      SecurityManager authenticator = (SecurityManager) authenticatorObject;
       authenticator.init(securityProps);
       Realm realm = new CustomAuthRealm(authenticator);
-      SecurityManager securityManager = new DefaultSecurityManager(realm);
+      org.apache.shiro.mgt.SecurityManager securityManager = new DefaultSecurityManager(realm);
       SecurityUtils.setSecurityManager(securityManager);
     }
     else {
@@ -366,7 +365,7 @@ public class GeodeSecurityUtil {
 
   public static boolean isIntegratedSecurity(String authenticatorFactoryName) {
     Object auth = getObject(authenticatorFactoryName);
-    return (auth instanceof IntegratedSecurity);
+    return (auth instanceof SecurityManager);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2f841f67/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
index 905eded..d80b936 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
@@ -33,7 +33,7 @@ import org.apache.shiro.subject.PrincipalCollection;
 
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.management.internal.security.ResourceConstants;
-import com.gemstone.gemfire.security.IntegratedSecurity;
+import com.gemstone.gemfire.security.SecurityManager;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.GeodePermission;
 
@@ -41,9 +41,9 @@ public class CustomAuthRealm extends AuthorizingRealm{
   public static final String REALM_NAME = "CUSTOMAUTHREALM";
 
   private static final Logger logger = LogManager.getLogger(CustomAuthRealm.class);
-  private IntegratedSecurity externalSecurity = null;
+  private SecurityManager externalSecurity = null;
 
-  public CustomAuthRealm(IntegratedSecurity auth) {
+  public CustomAuthRealm(SecurityManager auth) {
     externalSecurity = auth;
   }
 
@@ -51,10 +51,10 @@ public class CustomAuthRealm extends AuthorizingRealm{
   public CustomAuthRealm (String authenticatorFactory) {
     Object auth = GeodeSecurityUtil.getObject(authenticatorFactory);
 
-    if(!(auth instanceof IntegratedSecurity)){
-      throw new GemFireSecurityException("Integrated Security requires IntegratedSecurity interface.");
+    if(!(auth instanceof SecurityManager)){
+      throw new GemFireSecurityException("Integrated Security requires SecurityManager interface.");
     }
-    externalSecurity = (IntegratedSecurity) auth;
+    externalSecurity = (SecurityManager) auth;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2f841f67/geode-core/src/main/java/com/gemstone/gemfire/security/IntegratedSecurity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/IntegratedSecurity.java b/geode-core/src/main/java/com/gemstone/gemfire/security/IntegratedSecurity.java
deleted file mode 100644
index 9e44700..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/IntegratedSecurity.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.gemstone.gemfire.security;
-
-import java.security.Principal;
-import java.util.Properties;
-
-public interface IntegratedSecurity {
-
-  void init(Properties securityProps);
-
-  Principal authenticate(Properties props) throws AuthenticationFailedException;
-
-  default boolean authorize(Principal principal, GeodePermission permission) {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2f841f67/geode-core/src/main/java/com/gemstone/gemfire/security/SecurityManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/SecurityManager.java b/geode-core/src/main/java/com/gemstone/gemfire/security/SecurityManager.java
new file mode 100644
index 0000000..b19e5a8
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/SecurityManager.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import java.security.Principal;
+import java.util.Properties;
+
+public interface SecurityManager {
+
+  void init(Properties securityProps);
+
+  Principal authenticate(Properties props) throws AuthenticationFailedException;
+
+  default boolean authorize(Principal principal, GeodePermission permission) {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2f841f67/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
index 317b705..f34dfd8 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
@@ -43,7 +43,7 @@ import com.gemstone.gemfire.management.internal.security.ResourceConstants;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
-import com.gemstone.gemfire.security.IntegratedSecurity;
+import com.gemstone.gemfire.security.SecurityManager;
 import com.gemstone.gemfire.security.GeodePermission;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
@@ -95,7 +95,7 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
  * }
  * </pre>
  */
-public class SampleJsonAuthorization implements IntegratedSecurity {
+public class SampleJsonAuthorization implements SecurityManager {
 
   public static class Role {
     List<GeodePermission> permissions = new ArrayList<>();