We can provide a small snippet of code to disallow registrations. However, can you let us know how you plan to let users register on the site? There's no way for you (the admin) to create a link between a user and their Facebook or Google account. That must be done by them. So, if we provide the code, you'll need to create the user a Joomla account and then they would need to login to your site with Joomla and then link their account to a social network. After that, they'd be able to login with their social accounts.
Let us know if that's the flow you envision or if you were looking for something else.
Thanks,
Alex