Architecture of the Consent Management Service (CMS). The CMS has a three-layer architecture. The Interface Layer provides a document listener and a query listener. The first one receives consent documents and the latter queries for consent policies. The listener uses the validation engine from the Logic Layer in order to validate messages, documents and queries. The authorization manager is the core of CMS and implements the PDP and PEP. It uses the storage engine to fetch consent documents for a particular patient.