ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [13/26] incubator-ranger git commit: RANGER-744: Kafka Authorizer has updated how IP/Host is passed
Date Wed, 02 Dec 2015 23:19:29 GMT
RANGER-744: Kafka Authorizer has updated how IP/Host is passed

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

Branch: refs/heads/tag-policy
Commit: fa435a922ff03fc19d8416f0b304999b5b1b9806
Parents: 0dadcd1
Author: Don Bosco Durai <bosco@apache.org>
Authored: Tue Nov 24 22:48:34 2015 -0800
Committer: Don Bosco Durai <bosco@apache.org>
Committed: Tue Nov 24 22:48:34 2015 -0800

----------------------------------------------------------------------
 .../kafka/authorizer/RangerKafkaAuthorizer.java |  7 +------
 .../kafka/authorizer/RangerKafkaAuthorizer.java | 22 +++++++++++++++++++-
 2 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/fa435a92/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
index 29c2ceb..7ca12ce 100644
--- a/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
+++ b/plugin-kafka/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -101,11 +101,6 @@ public class RangerKafkaAuthorizer implements Authorizer {
 		}
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see kafka.security.auth.Authorizer#configure(Map<String, Object>)
-	 */
 	@Override
 	public void close() {
 		logger.info("close() called on authorizer.");
@@ -141,7 +136,7 @@ public class RangerKafkaAuthorizer implements Authorizer {
 		}
 		java.util.Set<String> userGroups = MiscUtil
 				.getGroupsForRequestUser(userName);
-		String ip = session.host();
+		String ip = session.clientAddress().getHostAddress();
 
 		// skip leading slash
 		if (StringUtils.isNotEmpty(ip) && ip.charAt(0) == '/') {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/fa435a92/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
----------------------------------------------------------------------
diff --git a/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
index 0937835..90b1ab0 100644
--- a/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
+++ b/ranger-kafka-plugin-shim/src/main/java/org/apache/ranger/authorization/kafka/authorizer/RangerKafkaAuthorizer.java
@@ -104,6 +104,26 @@ public class RangerKafkaAuthorizer implements Authorizer {
 	}
 
 	@Override
+	public void close() {
+		if(LOG.isDebugEnabled()) {
+			LOG.debug("==> RangerKafkaAuthorizer.close()");
+		}
+
+		try {
+			activatePluginClassLoader();
+			
+			rangerKakfaAuthorizerImpl.close();
+		} finally {
+			deactivatePluginClassLoader();
+		}
+
+		if(LOG.isDebugEnabled()) {
+			LOG.debug("<== RangerKafkaAuthorizer.close()");
+		}
+		
+	}
+
+	@Override
 	public boolean authorize(Session session, Operation operation,Resource resource) {	
 		if(LOG.isDebugEnabled()) {
 			LOG.debug("==> RangerKafkaAuthorizer.authorize(Session, Operation, Resource)");
@@ -268,4 +288,4 @@ public class RangerKafkaAuthorizer implements Authorizer {
 		}
 	}
 		
-}
\ No newline at end of file
+}


Mime
View raw message