Middleware for secure data retrieval from graph databases