How to authenticate users against private registry with dynamic url?

I set up a private docker registry on my linux machine and I also set up basic authentication for this so if you want to access images (pull/push) you need to login first.

The problem is I would like to have let say different storage volume per each user. For example, all operations are against host name:

docker push example:5000/my-image

What I would like to have is something like this:

docker push example:5000/<user_name>/my-image

In that case <user_name> would be something like repository name

What is a consequence of this, that each user would have his own storage volume that would not be accessible for other users. Please also refer to following link, GitHub does this exactly in a way I want

https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry

How to achive something like this?