From 80d6c640248271da46157fd3189f72b20596ea1b Mon Sep 17 00:00:00 2001 From: sunil unnava Date: Mon, 15 Oct 2018 17:02:34 -0400 Subject: [PATCH] add AAF based on a flag Issue-ID: DMAAP-849 Change-Id: I8f72ce6cd23bb1205fc6a1a54bd44bef8db0dfa8 Signed-off-by: sunil unnava --- demo/docker_files/__docker-compose.yml | 15 +++++++++++++++ pom.xml | 2 +- src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java | 6 ++++-- src/main/resources/docker-compose/docker-compose.yml | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/demo/docker_files/__docker-compose.yml b/demo/docker_files/__docker-compose.yml index 1606960..4ba6889 100644 --- a/demo/docker_files/__docker-compose.yml +++ b/demo/docker_files/__docker-compose.yml @@ -18,11 +18,24 @@ services: max-file: "5" kafka: + #CADI integrated kafka image + #image: nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.2 image: nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.1 ports: - "9092:9092" environment: + enableCadi: false KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + #Properties required for using the CADI integrated Kafka + #KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT,EXTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT + #KAFKA_ADVERTISED_LISTENERS: INTERNAL_SASL_PLAINTEXT://kafka:9092 + #KAFKA_LISTENERS: INTERNAL_SASL_PLAINTEXT://0.0.0.0:9092 + #KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL_SASL_PLAINTEXT + #KAFKA_SASL_ENABLED_MECHANISMS: PLAIN + #KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN + #KAFKA_AUTHORIZER_CLASS_NAME: org.onap.dmaap.kafkaAuthorize.KafkaCustomAuthorizer + #aaf_locate_url: https://aaf-onap-test.osaaf.org:8095 + #Remove the below 4 properties if CADI KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT KAFKA_ADVERTISED_LISTENERS: INTERNAL_PLAINTEXT://kafka:9092 KAFKA_LISTENERS: INTERNAL_PLAINTEXT://0.0.0.0:9092 @@ -38,6 +51,8 @@ services: max-file: "5" dmaap: + #CADI integrated MR image + #image: ${NEXUS_DOCKER_REPO}/onap/dmaap/dmaap-mr:1.1.7 image: ${NEXUS_DOCKER_REPO}/onap/dmaap/dmaap-mr:1.1.6 ports: - "3904:3904" diff --git a/pom.xml b/pom.xml index f44eb1b..a723370 100644 --- a/pom.xml +++ b/pom.xml @@ -457,7 +457,7 @@ org.onap.dmaap.messagerouter.msgrtr msgrtr - 1.1.9 + 1.1.10 org.slf4j diff --git a/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java b/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java index 652bfc2..64480e6 100644 --- a/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java +++ b/src/main/java/com/att/nsa/dmaap/util/DMaaPAuthFilter.java @@ -29,6 +29,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; +import com.att.dmf.mr.utils.Utils; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import org.springframework.stereotype.Component; @@ -69,10 +70,11 @@ public class DMaaPAuthFilter extends CadiFilter { log.info("inside servlet filter Cambria Auth Headers checking before doing other Authentication"); HttpServletRequest request = (HttpServletRequest) req; boolean forceAAF = Boolean.valueOf(System.getProperty("forceAAF")); + //if (forceAAF || null != request.getHeader("Authorization") ){ - if (forceAAF || null != request.getHeader("Authorization") || + if (Utils.isCadiEnabled()&&(forceAAF || null != request.getHeader("Authorization") || (null != request.getHeader("AppName") && request.getHeader("AppName").equalsIgnoreCase("invenio") && - null != request.getHeader("cookie"))){ + null != request.getHeader("cookie")))){ super.doFilter(req, res, chain); } else { diff --git a/src/main/resources/docker-compose/docker-compose.yml b/src/main/resources/docker-compose/docker-compose.yml index aece067..40a183e 100644 --- a/src/main/resources/docker-compose/docker-compose.yml +++ b/src/main/resources/docker-compose/docker-compose.yml @@ -6,11 +6,24 @@ services: - "2181:2181" kafka: + #CADI integrated kafka image + #image: nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.2 image: nexus3.onap.org:10001/onap/dmaap/kafka01101:0.0.1 ports: - "9092:9092" environment: + enableCadi: false KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + #Properties required for using the CADI integrated Kafka + #KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT,EXTERNAL_SASL_PLAINTEXT:SASL_PLAINTEXT + #KAFKA_ADVERTISED_LISTENERS: INTERNAL_SASL_PLAINTEXT://kafka:9092 + #KAFKA_LISTENERS: INTERNAL_SASL_PLAINTEXT://0.0.0.0:9092 + #KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL_SASL_PLAINTEXT + #KAFKA_SASL_ENABLED_MECHANISMS: PLAIN + #KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN + #KAFKA_AUTHORIZER_CLASS_NAME: org.onap.dmaap.kafkaAuthorize.KafkaCustomAuthorizer + #aaf_locate_url: https://aaf-onap-test.osaaf.org:8095 + #Remove the below 4 properties if CADI is enabled KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT KAFKA_ADVERTISED_LISTENERS: INTERNAL_PLAINTEXT://kafka:9092 KAFKA_LISTENERS: INTERNAL_PLAINTEXT://0.0.0.0:9092 @@ -21,6 +34,8 @@ services: - zookeeper dmaap: + #CADI integrated MR image + #image: ${NEXUS_DOCKER_REPO}/onap/dmaap/dmaap-mr:1.1.7 image: nexus3.onap.org:10001/onap/dmaap/dmaap-mr:1.1.6 ports: - "3904:3904" -- 2.16.6