Plugin with URL requires basic authentication

Hello,

I’m writing my first plugin. From directory items I have to access to resources, for which basic authentication is required.

Does anyone know, how to pass username and password to such resource?