Backporting of GEOT-4792: optimizations for JDBCDataStore ensureAuthorization