class DefaultCallbackClientFinder implements ClientFinder {

    /**
     * <p>Constructor for DefaultCallbackClientFinder.</p>
     */
    public DefaultCallbackClientFinder() {}

    /** {@inheritDoc} */
    @Override
    public List<Client> find(final Clients clients, final WebContext context, final String clientNames) {<FILL_FUNCTION_BODY>}
}


        List<Client> result = new ArrayList<>();
        List<Client> indirectClients = new ArrayList<>();

        for (val client : clients.findAllClients()) {
            if (client instanceof IndirectClient indirectClient) {
                indirectClients.add(client);
                indirectClient.init();
                if (indirectClient.getCallbackUrlResolver().matches(indirectClient.getName(), context)) {
                    result.add(indirectClient);
                }
            }
        }
        LOGGER.debug("result: {}", result.stream().map(Client::getName).collect(Collectors.toList()));

        // fallback: no client found and we have a default client, use it
        if (result.isEmpty() && CommonHelper.isNotBlank(clientNames)) {
            val defaultClient = clients.findClient(clientNames);
            if (defaultClient.isPresent()) {
                LOGGER.debug("Defaulting to the configured client: {}", defaultClient);
                result.add(defaultClient.get());
            }
        }
        // fallback: no client found and we only have one indirect client, use it
        if (result.isEmpty() && indirectClients.size() == 1) {
            LOGGER.debug("Defaulting to the only client: {}", indirectClients.get(0));
            result.addAll(indirectClients);
        }

        return result;
    
<no_super_class>