How to add an authentication layer to Docker REST API? [duplicate]

I am trying to connect to docker daemon through a tcp port using REST API remotely. Currently anyone can access it through the endpoint. How can I make it secured with Oauth or ID/Password?

Source: Docker Questions