Backporting of GEOT-4792: optimizations for the JDBCDataStore.ensureAuthorization