From 1bc5db9215e0dc314d49e4e11a112e272bbc23ca Mon Sep 17 00:00:00 2001 From: su622b Date: Fri, 20 Apr 2018 15:45:40 -0400 Subject: Changes for AAF authentication Issue-ID: DMAAP-245 Change-Id: I92076166f38ff948a4d2719fe983a2ef64514849 Signed-off-by: su622b --- .../security/DMaaPAAFAuthenticatorImpl.java | 30 +++------------------- .../nsa/cambria/service/impl/TopicServiceImpl.java | 2 ++ 2 files changed, 5 insertions(+), 27 deletions(-) (limited to 'src/main/java/com/att/nsa') diff --git a/src/main/java/com/att/nsa/cambria/security/DMaaPAAFAuthenticatorImpl.java b/src/main/java/com/att/nsa/cambria/security/DMaaPAAFAuthenticatorImpl.java index 6f4d9c9..e8f697e 100644 --- a/src/main/java/com/att/nsa/cambria/security/DMaaPAAFAuthenticatorImpl.java +++ b/src/main/java/com/att/nsa/cambria/security/DMaaPAAFAuthenticatorImpl.java @@ -21,17 +21,12 @@ *******************************************************************************/ package com.att.nsa.cambria.security; -import java.util.Date; import javax.servlet.http.HttpServletRequest; -import org.apache.http.HttpStatus; import com.att.nsa.cambria.CambriaApiException; import com.att.nsa.cambria.constants.CambriaConstants; -import com.att.nsa.cambria.exception.DMaaPResponseCode; -import com.att.nsa.cambria.exception.ErrorResponse; -import com.att.nsa.cambria.utils.Utils; /** @@ -60,28 +55,9 @@ public class DMaaPAAFAuthenticatorImpl implements DMaaPAAFAuthenticator { public String aafPermissionString(String topicName, String action) throws CambriaApiException { - String permission = ""; - String nameSpace =""; - if(topicName.contains(".") && (topicName.contains("com.onap")||topicName.contains("org"))) { - //String topic = topicName.substring(topicName.lastIndexOf(".")+1); - nameSpace = topicName.substring(0,topicName.lastIndexOf(".")); - } - else { - nameSpace = null; - nameSpace= com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,"defaultNSforUEB"); - - if(null==nameSpace)nameSpace="com.onap.dmaap.mr.ueb"; - - - /*ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, - DMaaPResponseCode.TOPIC_NOT_IN_AAF.getResponseCode(), "Topic does not exist in AAF" - , null, Utils.getFormattedDate(new Date()), topicName, - null, null, null, null); - - throw new CambriaApiException(errRes);*/ - } - - permission = nameSpace+".mr.topic|:topic."+topicName+"|"+action; + String mrNameS = com.att.ajsc.beans.PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, + "msgRtr.namespace.aaf"); + String permission = mrNameS+"|:topic."+topicName+"|"+action; return permission; } diff --git a/src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java b/src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java index f539199..7875b90 100644 --- a/src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java +++ b/src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java @@ -314,7 +314,9 @@ public class TopicServiceImpl implements TopicService { // String permission = "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage"; String permission = ""; String nameSpace=""; + if(topicName.indexOf(".")>1){ nameSpace = topicName.substring(0,topicName.lastIndexOf(".")); + } String mrFactoryVal=AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,"msgRtr.topicfactory.aaf"); // String tokens[] = topicName.split(".mr.topic."); permission = mrFactoryVal+nameSpace+"|destroy"; -- cgit 1.2.3-korg