Hello,
while evaluating syncope a problem has come up: I want to create users from
within anyObject workflow but it does not work as expected. In detail:
I have implemented
1. a FlowableAnyObjectWorkflowAdapter which is based on the existing
FlowableUserWorkflowAdapter,
2. a task for creating anyObjects which based on the existing Create task,
3. an anyType
---
key: "myAny"
kind: "ANY_OBJECT"
classes: []
4. the task
public class CreateUser extends FlowableServiceTask {
private final UserWorkflowAdapter userWorkflowAdapter;
public CreateUser(final UserWorkflowAdapter userWorkflowAdapter) {
this.userWorkflowAdapter = userWorkflowAdapter;
}
@Override
protected void doExecute(final DelegateExecution execution) {
userWorkflowAdapter.create(
new UserCR.Builder("/", "test").build(),
"creator",
"context"
);
}
}
for creating users and
5. a workflow for anyObjects (ids of edges are removed)
<process id="anyObjectWorkflow" name="anyObjectWorkflow" isExecutable="true">
<startEvent id="startevent1" name="Start"
flowable:formFieldValidation="true"/>
<sequenceFlow sourceRef="startevent1" targetRef="createAnyObject"/>
<serviceTask id="createAnyObject" name="Create AnyObject"
flowable:delegateExpression="${createAnyObject}"/>
<sequenceFlow sourceRef="createAnyObject" targetRef="createUser"/>
<serviceTask id="createUser" name="Create User"
flowable:delegateExpression="${createUser}"/>
<sequenceFlow sourceRef="createUser" targetRef="active"/>
<userTask id="active" name="Active" flowable:formFieldValidation="true"/>
<sequenceFlow sourceRef="active" targetRef="endevent1"/>
<endEvent id="endevent1" name="End"/>
</process>
which, on create, creates the anyObject and additionally a user and stops
in a user task.
In the console, adding an instance of anyType "myAny" completes
successfully but afterwards the console becomes partially unusable:
1. Opening the realms view gives Unexpected RuntimeException
Last cause: Unexpected character ('<' (code 60)): expected a valid value (JSON
String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source:
(org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$7);
line: 1, column: 2]
WicketMessage: Error attaching this container for rendering:
[WebMarkupContainer [Component id = body]]
2. Trying to log in I always get "Wrong username and/or password".
This seems to by caused by
DEBUG [IO-1 task-2] org.springframework.security.web.FilterChainProxy
: Secured GET /actuator/info/
DEBUG [IO-1 task-2]
ot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping : Mapped to
Actuator web endpoint 'info'
WARN [IO-1 task-2] work.web.servlet.mvc.support.DefaultHandlerExceptionResolver : Resolved
[org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Null key
for a Map not allowed in JSON (use a converting NullKeySerializer?); nested exception is
com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a
converting NullKeySerializer?) (through reference chain:
java.util.Collections$UnmodifiableMap["numbers"]->org.apache.syncope.common.lib.info.NumbersInfo["usersByStatus"])]
which in turn is caused by the user's status being null:
{
"_class": "org.apache.syncope.common.lib.to.UserTO",
"key": "0190a1f1-4a18-7066-8783-278d63e87abd",
"type": "USER",
"realm": "/",
"username": "test",
"creator": "creator",
"creationDate": "2024-07-11T13:17:43.953038683Z",
"creationContext": "context",
"lastModifier": "creator",
"lastChangeDate": "2024-07-11T13:17:43.953038683Z",
"lastChangeContext": "context",
"dynRealms": [],
"status": null,
"auxClasses": [],
"plainAttrs": [],
"derAttrs": [],
"virAttrs": [],
"resources": [],
"password": null,
"token": null,
"tokenExpireTime": null,
"lastLoginDate": null,
"changePwdDate": null,
"failedLogins": 0,
"securityQuestion": null,
"securityAnswer": null,
"suspended": false,
"mustChangePassword": false,
"relationships": [],
"memberships": [],
"dynMemberships": [],
"roles": [],
"dynRoles": [],
"privileges": [],
"linkedAccounts": [],
"delegatingDelegations": [],
"delegatedDelegations": []
}
And in fact, the status is never set:
WARN [IO-1 task-2] org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils
: While setting user status: unexpected task number (0)
So, what am I missing? Or is creating users from within anyObject workflow
not supposed to work at all? Help would be appreciated.
Best Regards
Stephan
--
Stephan Feder, Senior Software-Entwickler
Technische Universität Darmstadt
Hochschulrechenzentrum, Alexanderstraße 2, 64283 Darmstadt
Tel. +49 6151 16-71162
https://www.hrz.tu-darmstadt.de/