Custom taskAssigneeOrCandidate implementation

Hello!
is it possible to customize this method (and similar methods) supplying custom identityservice?

Note that, I want to resolve assignee/candidate not through db call but rest call.