Restrict file download similar to website access using password/registration

I would like to restrict not only access to websites but also to files. Restricted websites with a download link allow copying the link and distributing it. A similar restriction to website access on file level would be very helpful. This is actually possible with other management systems.