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:50 UTC

[30/50] [abbrv] incubator-geode git commit: GEODE-1571: rename ExternalSecurity to CustomSecurity

GEODE-1571: rename ExternalSecurity to CustomSecurity


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

Branch: refs/heads/develop
Commit: cd0d11abaf6b4b8ef5f91c2d06aed02bb3af175d
Parents: 1a92021
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 12:07:38 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 12:07:38 2016 -0700

----------------------------------------------------------------------
 .../internal/security/GeodeSecurityUtil.java    | 10 +++---
 .../security/shiro/CustomAuthRealm.java         | 12 +++----
 .../gemfire/security/CustomSecurity.java        | 32 ++++++++++++++++++
 .../gemfire/security/ExternalSecurity.java      | 34 --------------------
 .../templates/SampleJsonAuthorization.java      |  4 +--
 5 files changed, 45 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/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 af1788a..a80e522 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
@@ -49,7 +49,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.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.GeodePermission;
 import com.gemstone.gemfire.security.GeodePermission.Operation;
@@ -313,9 +313,9 @@ public class GeodeSecurityUtil {
       SecurityUtils.setSecurityManager(securityManager);
     }
 
-    // only set up shiro realm if user has implemented ExternalSecurity
-    else if (authenticatorObject != null && authenticatorObject instanceof ExternalSecurity) {
-      ExternalSecurity authenticator = (ExternalSecurity) authenticatorObject;
+    // only set up shiro realm if user has implemented CustomSecurity
+    else if (authenticatorObject != null && authenticatorObject instanceof CustomSecurity) {
+      CustomSecurity authenticator = (CustomSecurity) authenticatorObject;
       authenticator.init(securityProps);
       Realm realm = new CustomAuthRealm(authenticator);
       SecurityManager securityManager = new DefaultSecurityManager(realm);
@@ -362,7 +362,7 @@ public class GeodeSecurityUtil {
 
   public static boolean isIntegratedSecurity(String authenticatorFactoryName) {
     Object auth = getObject(authenticatorFactoryName);
-    return (auth instanceof ExternalSecurity);
+    return (auth instanceof CustomSecurity);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/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 cb3b116..dc7755e 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.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 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 ExternalSecurity externalSecurity = null;
+  private CustomSecurity externalSecurity = null;
 
-  public CustomAuthRealm(ExternalSecurity auth) {
+  public CustomAuthRealm(CustomSecurity auth) {
     externalSecurity = auth;
   }
 
@@ -51,10 +51,10 @@ public class CustomAuthRealm extends AuthorizingRealm{
   public CustomAuthRealm (String authenticatorFactory) {
     Object auth = GeodeSecurityUtil.getObject(authenticatorFactory);
 
-    if(!(auth instanceof ExternalSecurity)){
-      throw new GemFireSecurityException("Integrated Security requires ExternalSecurity interface.");
+    if(!(auth instanceof CustomSecurity)){
+      throw new GemFireSecurityException("Integrated Security requires CustomSecurity interface.");
     }
-    externalSecurity = (ExternalSecurity) auth;
+    externalSecurity = (CustomSecurity) auth;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java b/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java
new file mode 100644
index 0000000..1e30902
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.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 CustomSecurity {
+
+  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/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java b/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
deleted file mode 100644
index 133eba2..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
+++ /dev/null
@@ -1,34 +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 ExternalSecurity {
-
-  void init(Properties securityProps);
-
-  Principal authenticate(Properties props) throws AuthenticationFailedException;
-
-  default boolean authorize(Principal principal, GeodePermission permission) {
-    return true;
-  }
-
-  //post-processing as well if we can find a good way to support it
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/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 a86c871..c69e4c6 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.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 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 ExternalSecurity {
+public class SampleJsonAuthorization implements CustomSecurity {
 
   public static class Role {
     List<GeodePermission> permissions = new ArrayList<>();