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 );
-
- }
}
{
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 ();
}
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();
}
//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.");
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"))) {
}
}
- }
try {
final String topicName = topicBean.getTopicName();
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
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
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