All the factory requires is a database adapter.
$adapter = $serviceLocator->get('Zend/Db/Adapter/Adapter');
$factory = new TableGatewayFactory($adapter);
Since you have provided the adapter now you can directly create the TableGateway using just the table name or also a schema name.
$users = $factory->create('users');
$users = $factory->create('users', 'myAuthSchema');
Now the TableGateway is created, you can use it like it have always been.
$rows = $users->select([
'username' => 'admin',
'password' => 'nimda'
])->toArray();