Authenticate API with Username and Password

How can I authenticate a user with a username and password via the API?

In the previous version you could (in config/public/api/auth/php) do

return $this->invoke('Cockpit\\Controller\\RestApi', 'authUser');

But apparently this doesn’t work anymore.

Thanks in advance!