Hi,
I was using mysql database with auto-generated tables using camunda-springboot-starter. Also I added dependency for the camunda web applications.
Problem is, when i setup initial camunda admin user/group/group membership by using camunda identityservice java api after the application was bootstrapped successfully, then i was not able to access cockpit/tasklist/admin page. But user, group and membership was created successfully.
I was able to access only this page (user setup was using identityservice java api).
If i don’t setup initial admin user using camunda identityservice, then setup page is loaded there i can input the user details and then i was able to access cockpit/tasklist/admin page.
Any reasons why the webapps(tasklist/admin/dashboard) page is not loading when we setup user and group using camunda identityservice java api?
Code used to create admin user and group membership:
@Slf4j
@Component(value = "camundaIdentityService")
public class CamundaIdentityService {
@Autowired
private IdentityService identityService;
@Autowired
@Qualifier("workflowConfig")
private WorkflowConfig workflowConfig;
@EventListener(ApplicationReadyEvent.class)
public void configureCamundaAdminUser() {
log.info("CamundaIdentityService is invoked to configure camunda adminuser/group/memebership...");
User camundaAdminUser = identityService.createUserQuery().userId(workflowConfig.getWorkflowusername())
.singleResult();
if (Objects.nonNull(camundaAdminUser) && camundaAdminUser.getId().equals(workflowConfig.getWorkflowusername())) {
boolean isCredentialUpdateReqd = identityService.checkPassword(workflowConfig.getWorkflowusername(),
workflowConfig.getWorkflowpassword());
if (!isCredentialUpdateReqd) {
camundaAdminUser.setPassword(workflowConfig.getWorkflowpassword());
identityService.saveUser(camundaAdminUser);
}
} else {
camundaAdminUser = identityService.newUser(workflowConfig.getWorkflowusername());
camundaAdminUser.setId(workflowConfig.getWorkflowusername());
camundaAdminUser.setPassword(workflowConfig.getWorkflowpassword());
camundaAdminUser.setFirstName(WorkflowConstants.CAMUNDA_ADMIN_FIRST_NAME);
camundaAdminUser.setLastName(WorkflowConstants.CAMUNDA_ADMIN_LAST_NAME);
camundaAdminUser.setEmail(WorkflowConstants.CAMUNDA_ADMIN_EMAIL);
identityService.saveUser(camundaAdminUser);
}
Group camundaAdminGroup = identityService.createGroupQuery().groupId(WorkflowConstants.CAMUNDA_ADMIN_GROUP)
.singleResult();
if (Objects.isNull(camundaAdminGroup)) {
camundaAdminGroup = identityService.newGroup(WorkflowConstants.CAMUNDA_ADMIN_GROUP);
camundaAdminGroup.setName(WorkflowConstants.CAMUNDA_ADMIN_GROUP_TITLE);
camundaAdminGroup.setType(WorkflowConstants.CAMUNDA_ADMIN_TYPE);
identityService.saveGroup(camundaAdminGroup);
}
Group userGroupMembership = identityService.createGroupQuery().groupId(WorkflowConstants.CAMUNDA_ADMIN_GROUP)
.groupMember(workflowConfig.getWorkflowusername()).singleResult();
if (Objects.isNull(userGroupMembership)) {
identityService.createMembership(workflowConfig.getWorkflowusername(), WorkflowConstants.CAMUNDA_ADMIN_GROUP);
}
}
}
CC: @jangalinski