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?