In this paper we deal with the problem of secure access to metadata information in Grid computing environments. The heterogeneity of the eventual data providers (with different local database management systems) and the enforcement of security policies for a vast number of potential data consumers are the two key problems to be solved. We present XSQL, a technology that solves the heterogeneity problem but lacks adequate security mechanisms for its use in grid like environments. As a consequence, we propose an advanced have security infrastructure with the necessary elements to be able to enforce complex policies based on identity and context information like roles and groups. The approach presented here results in authorization schemas that need no additional coding from data providers and, as a result, require little deployment efforts.