Is there any way to protect account creation and login to test environments

Hi!
Is there any way to protect account creation and login to test environments?

For example:

app.com - production environment. Everyone can register here
test.app.com - test environment. Here only our internal users register here

Thanks