Refused to deploy workflow through camunda moduler

Hey,
I integrated camunda with my spring project and I am trying to deploy a workflow through Camunda Moduler.


but the problem is that I can not deploy it. As I know the Authentication is disabled by default, but I keep getting asked for HTTP basic. I tryed to deploy it through postman and it works fine without any authentication. but I would like to deploy it with Camunda Moduler.
So I decided to add an authentication so I can deploy it with Camunda Moduler.

here is my code in configuration class

  @Configuration
public class EngineConfiguration  {
	
	private final static Logger logger = LoggerFactory.getLogger(EngineConfiguration.class);

	@Autowired
	private DataSource dataSource;

	
	@Autowired
	private PlatformTransactionManager transactionManager;

	
	@Autowired
	private ResourcePatternResolver resourceResolver;
	
	@Autowired
	private IdentityService identityService;
	
	@Value(value = "${workflowEngine.jobExecutorActivate:true}")
	private boolean jobExecutorActivate;

	@Bean
	public SpringProcessEngineConfiguration getProcessEngineConfiguration() {
		SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
		config.setDataSource(dataSource);
		config.setAuthorizationEnabled(true);
		config.setTransactionManager(transactionManager);
		config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);  // Always check and update
		logger.info("Camunda DatabaseSchemaUpdate: " + config.getDatabaseSchemaUpdate());
		config.setJobExecutorActivate(jobExecutorActivate);
		try {
			
			config.setDeploymentResources(resourceResolver
					.getResources("classpath*:**/**/*.bpmn"));
		} catch (IOException e) {
			logger.error("Failed to load bpmn files", e);
			throw new RuntimeException(e);
		}

		return config;
	}

	@Primary
	@Bean(destroyMethod = "destroy")
	public ProcessEngineFactoryBean processEngineFactory() {
		ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
		processEngineFactoryBean
				.setProcessEngineConfiguration(getProcessEngineConfiguration());
		return processEngineFactoryBean;
	}

	
	public ProcessEngine processEngine() {
		try {
			return processEngineFactory().getObject();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	
	@Bean
	public RuntimeService getRuntimeService() {
		return processEngine().getRuntimeService();
	}

	@Bean
	public AuthorizationService getAuthorizationService() {
		return processEngine().getAuthorizationService();
	}

	@Bean
	public FormService getFormService() {
		return processEngine().getFormService();
	}

	@Bean
	public HistoryService getHistoryService() {
		return processEngine().getHistoryService();
	}

	
	@Bean
	public IdentityService getIdentityService() {
		return processEngine().getIdentityService();
	}

	
	
	
	@Bean
	public ManagementService getManagementService() {
		return processEngine().getManagementService();
	}

	
	
	@Bean
	public RepositoryService getRepositoryService() {
		return processEngine().getRepositoryService();
	}

	
	
	
	@Bean
	public TaskService getTaskService() {
		return processEngine().getTaskService();
	}
	
	
	 @Bean
	  public FilterRegistrationBean<Filter> processEngineAuthenticationFilter() {
	    FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
	    registration.setName("camunda-auth");
	    Filter myFilter = new ProcessEngineAuthenticationFilter();
		registration.setFilter(myFilter);
	    registration.addInitParameter("authentication-provider",
	        "org.camunda.bpm.engine.rest.security.auth.impl.HttpBasicAuthenticationProvider");
	    registration.addUrlPatterns("/engine-rest/*");
	    registration.setOrder(1);
	  
	    return registration;
	  }
	 }

My username and password for Camunda Webapp is “demo”. I tryed to test that by calling this http://localhost:8080/engine-rest/default/user but I got this error “status”:401,“error”:“Unauthorized”,“message”:"No authorized session found ".

so can you help me please what am I missing or what should I do so the Authentication works and I can deploy my workflow through camunda moduler?

Can you descrive more about you Camunda setup?
How you built the project, the version of Camunda you’re using.
Also uploading your Pom file and your application.yaml would also help

Hey Niall,
Thank you for your responed. Actually its a big project but we are using Gradle Project. Camunda’s version is 7.13.0. and thats my Dependecies

dependencies {

	// Camunda
	compile("org.camunda.bpm:camunda-engine:$camundaVersion")
	compile("org.camunda.bpm:camunda-engine-spring:$camundaVersion")
	compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter', version: '7.13.0'
	compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-test', version: '7.13.0'
	compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-rest', version: '7.13.0'
	compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-webapp', version: '7.13.0'
}

because the project and Camunda webapp using localhost:8080, I added this line camunda.bpm.webapp.index-redirect-enabled=false in the file application.properties so I can use both of them. now I can open camund webapp through this link http://localhost:8080/camunda/app/welcome/default/#!/login

in the ymal file there is only this lines

# ----------------------------------
# MYSQL
# ----------------------------------

spring:
    datasource:
        url: jdbc:mysql://localhost/DB_dev?serverTimezone=UTC&nullCatalogMeansCurrent=true
        username: test
        password: test
        maxWait: 30000
        maxPoolSize: 8
        defaultAutoCommit: false
        driverClassName: com.mysql.cj.jdbc.Driver
        testOnBorrow: true
        validationQuery: SELECT 1
  

      
workflowEngine:
   createSchema: false
  
#server:
 # servlet:
  #  context-path: /camunda
  
camunda.bpm.admin-user:
  id: demo
  password: demo
  

I hope it helps what I have said.

Have you got spring secturity added by any chance?
Also - have you made sure that the version of Camunda matches with the version of Spring boot? There’s a compatibility matrix you could take a look at

yeah we have JWT. and yes camunda version is matching with camunda spring boot starter. they are 7.13.0

For JWT authentication, you should select Bearer token and paste your token to the input.

1 Like

I have tryed that before but it did not work. what I dont understand even if I am not having an authentication, Camunda modeler is going to ask me after the authentication but if I used postman its going to work fine without any authentication.