If there is some problem with the public key file specified for authentication then the client will just state "You are not authorized to connect to this server." This is probably not the most helpful message when the issue is that we didn't even try a key.
It is apparent what the problem is in the log though:
> 2018-06-29T12:24:37: ssh[E]: no such identity: foo: No such file or directory
See also bug 5317.
See also bug 7313.
The function works fine on Linux and Windows.
However, the error messages (for this and bug 5317) are perhaps a bit too short and specific for an end user error message. I think some more details would be appropriate so that the user can know what to do next.
Have improved the messages for the end users now.
Looks good now, and also checked release notes.