changes for deployment errors 77/37577/1 v1.1.2
authorsu622b <sunil.unnava@att.com>
Wed, 21 Mar 2018 20:22:41 +0000 (16:22 -0400)
committersu622b <sunil.unnava@att.com>
Wed, 21 Mar 2018 20:22:53 +0000 (16:22 -0400)
Issue-ID: DMAAP-332
Change-Id: I28da5fea23c8680fb921c97348eee26edb86ed35
Signed-off-by: su622b <sunil.unnava@att.com>
src/main/java/com/att/nsa/cambria/security/DMaaPAuthenticatorImpl.java
src/main/java/com/att/nsa/cambria/service/impl/AdminServiceImpl.java
src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java
src/test/java/com/att/nsa/cambria/service/impl/TopicServiceImplTest.java

index dfcb0d5..709d035 100644 (file)
@@ -132,9 +132,5 @@ public class DMaaPAuthenticatorImpl<K extends NsaApiKey> implements DMaaPAuthent
                this.fAuthenticators.add(a);
        }
        
-       public static boolean isIgnoreAuth(){
-               return (System.getenv("ignoreAuth")!=null) ? Boolean.valueOf(System.getenv("ignoreAuth")):(System.getProperty("ignoreAuth")!=null? Boolean.valueOf(System.getProperty("ignoreAuth")):false );
-               
-       }
 
 }
index ead9c36..8b651f5 100644 (file)
@@ -161,7 +161,7 @@ public class AdminServiceImpl implements AdminService {
        {
                
                final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dMaaPContext);
-               if ( (!DMaaPAuthenticatorImpl.isIgnoreAuth())&&(user == null || !user.getKey ().equals ( "admin" )) )
+               if ( (user == null || !user.getKey ().equals ( "admin" )) )
                {
                        throw new AccessDeniedException ();
                }
index 3690583..a9c1882 100644 (file)
@@ -195,7 +195,6 @@ public class TopicServiceImpl implements TopicService {
                String key = null;
                String appName=dmaapContext.getRequest().getHeader("AppName");
                String enfTopicName= com.att.ajsc.beans.PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop,"enforced.topic.name.AAF");
-           if(DMaaPAuthenticatorImpl.isIgnoreAuth()){
                if(user != null)
                {
                        key = user.getKey();
@@ -214,7 +213,7 @@ public class TopicServiceImpl implements TopicService {
                }
                                
                //else if (user==null && (null==dmaapContext.getRequest().getHeader("Authorization") && null == dmaapContext.getRequest().getHeader("cookie")) ) {
-                       else if (user == null &&  null==dmaapContext.getRequest().getHeader("Authorization")     && 
+                       /*else if (user == null &&  null==dmaapContext.getRequest().getHeader("Authorization")     && 
                                         (null == appName  &&  null == dmaapContext.getRequest().getHeader("cookie"))) {
                        LOGGER.error("Failed to create topic"+topicBean.getTopicName()+", Authentication failed.");
                        
@@ -223,7 +222,7 @@ public class TopicServiceImpl implements TopicService {
                                        errorMessages.getCreateTopicFail()+" "+errorMessages.getNotPermitted1()+" create "+errorMessages.getNotPermitted2());
                        LOGGER.info(errRes.toString());
                        throw new DMaaPAccessDeniedException(errRes);
-               }
+               }*/
                
                if (user == null &&  (null!=dmaapContext.getRequest().getHeader("Authorization") ||
                                         null != dmaapContext.getRequest().getHeader("cookie"))) {
@@ -266,7 +265,6 @@ public class TopicServiceImpl implements TopicService {
                                
                        }
                }
-           }
 
                try {
                        final String topicName = topicBean.getTopicName();
index c90ba54..eb7e046 100644 (file)
@@ -135,7 +135,6 @@ public class TopicServiceImplTest {
        public void testCreateTopicWithEnforcedName()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
                \r
-               PowerMockito.when(DMaaPAuthenticatorImpl.isIgnoreAuth()).thenReturn(true);\r
                Assert.assertNotNull(topicService);\r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
 \r
@@ -201,7 +200,6 @@ public class TopicServiceImplTest {
        public void testCreateTopicNoUserInContextAndNoAuthHeader()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
                \r
-               PowerMockito.when(DMaaPAuthenticatorImpl.isIgnoreAuth()).thenReturn(true);\r
                Assert.assertNotNull(topicService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r
@@ -225,7 +223,6 @@ public class TopicServiceImplTest {
        public void testCreateTopicNoUserInContextAndAuthHeaderAndPermitted()\r
                        throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
                \r
-               PowerMockito.when(DMaaPAuthenticatorImpl.isIgnoreAuth()).thenReturn(true);\r
                Assert.assertNotNull(topicService);\r
 \r
                PowerMockito.mockStatic(PropertiesMapBean.class);\r