Keycloak for GDPR security of processing and data protection by design

A self-hosted Keycloak can support GDPR Articles 25 and 32 for personal data in identity records, but the controller still owns the minimization, transfer and records decisions. This page maps what the platform helps with and what it does not.

On this page

Keycloak for GDPR security of processing and data protection by design: what it helps with

Self-hosted Keycloak supports the duties in GDPR Article 25 (data protection by design and by default) and Article 32 (security of processing) for personal data held in identity records, but it does not make your organization compliant by itself. Article 25 and Article 32 are obligations on the controller or processor, and they are met through the design of your whole identity service, its hosting, its administration and its review over time. The GDPR requires no certificate or attestation for this, and certification under Article 42 is voluntary and does not reduce your responsibility. DeployOpen configures, hardens and documents Keycloak in your infrastructure and prepares the systems, controls and evidence your compliance team reviews, but DeployOpen does not issue audit reports, attestations or certifications.

The practical question is which parts of the identity service you control. Article 25(2) asks that only the personal data needed for each purpose is processed by default, so the work starts with the user profile schema, the attributes mapped into tokens and the claims released to each client. Article 32 asks for a level of security appropriate to the risk, so the work continues with where the database and cluster run, who can reach the admin console and Administration REST API, and how administrative changes and login events are logged. Confirm with your data protection officer which attributes are truly necessary, and confirm with your security team where the admin endpoints are exposed.

Keep the record of processing current as well. Article 30 expects a general description of the Article 32(1) measures where possible, so your Keycloak configuration, hosting location, access model and deletion workflow should be written down in a form that matches the running system. EDPB Guidelines 4/2019 state that the obligation applies to all controllers regardless of size and requires regular review of the effectiveness of the chosen measures. Plan that review as a recurring task with named owners, not a one-time project.

Mapping GDPR Articles 25 and 32 to Keycloak settings

This table maps each GDPR provision in scope to the Keycloak capability that supports it, the configuration that makes the capability work, and the decisions that stay with the controller. Read each row as a question to answer for your own deployment. The main takeaway is that Keycloak supplies tools for minimal data and access control, but the controller decides which data is collected, who may see it and how long it is kept.

ProvisionKeycloak capability and configurationWhat remains with the controller
Article 32(1): appropriate security of processingEnforce TLS on all communication, place a reverse proxy in front of the server with path restrictions, and serve the admin console and Administration REST API on a different hostname or context path from public frontend URLs.Choose the risk-based measures, document why they are appropriate, review their effectiveness regularly and confirm the hosting and operating model meets your own risk assessment.
Article 32(2): risks of destruction, loss, alteration or unauthorised disclosureEnable login and admin event logging, persist login failures to the database (the default in Keycloak 26.8), and expose metrics at /metrics with --metrics-enabled=true for monitoring. Use database backups and a synchronously replicated database for high availability designs.Set retention for event and metric data, test restores, define who reviews logs and how breaches are escalated, and confirm backup and log storage location meets your transfer analysis.
Article 25(1): data minimisation and pseudonymisationLimit user profile attributes to those each application needs, keep token claims to the minimum scopes and mappers required, and use the subject identifier rather than email or name as the stable key where applications allow it.Decide which personal data is necessary for each purpose, justify it, and document pseudonymisation choices. Keycloak does not decide what your applications need.
Article 25(2): default minimal processing and accessibilityUse default user profile settings that do not require optional fields, restrict self-service account pages to fields users must maintain, and use realm and client scopes so tokens carry only the claims a client is authorised to receive.Set storage periods for inactive or deleted accounts, decide who may view personal data by default, and verify that defaults are reviewed when new applications or identity providers are added.
Article 25(2): self-service and erasureEnable the account console so users can view and update their own profile, and use admin workflows or APIs to disable and delete accounts when a request or retention period ends.Define the erasure process, handle requests within the timelines your legal team sets, and confirm that backups, logs and downstream systems also apply the erasure outcome.
Article 30: records of processingExport realm configuration, client lists, identity provider settings and role mappings as configuration files, and keep admin and event logs that show who changed what and when.Write the record of processing, including a general description of the Article 32(1) measures, and maintain it when the Keycloak configuration changes.
Admin access control (supports Articles 25 and 32)Assign admin roles per realm and per function, avoid using the master realm for daily administration, and require strong authentication for administrators.Decide who holds each admin role, review assignments on a schedule, and document joiner and leaver handling for administrators.

How Keycloak user profiles and tokens limit personal data by default

Article 25(2) requires that, by default, only the personal data necessary for each specific purpose is processed. It covers the amount collected, the extent of processing, the storage period and who can access the data. In Keycloak, most of those choices are made in the realm user profile and in the token configuration of each client. The user profile decides what personal data a user record can hold, and client scopes and protocol mappers decide what leaves the server. Review both before go-live, because a default that collects or releases more than a given application needs is a design gap under Article 25, not a cosmetic issue.

Start with the user profile. Keycloak lets you define which attributes exist, which are required, which are optional, and who can view or edit each one (the user, the administrator, or both). Keep required attributes to what authentication and account recovery genuinely need, such as a username and an email address. Treat fields like phone number, date of birth or employee identifiers as optional, and only add them when a named application or process depends on them. Confirm in your target version how the user profile is enabled and how unmanaged attributes are handled, since those settings determine whether users can store data outside the defined schema.

Tokens are copies of personal data. Every claim in an ID token or access token is disclosed to the client that receives it, and tokens may be logged, cached or forwarded by that client. Scope each client by limiting its client scopes to the claims it needs, and use protocol mappers to add only those attributes, rather than relying on a broad default that releases the full profile. Review the mappers on every client, including internal ones, and confirm the token lifetimes and userinfo behavior in your version against the Keycloak server administration guide. Record the resulting claim set per client, because it is the evidence you will need for your records of processing.

Evidence auditors and supervisory authorities ask for from Keycloak

A supervisory authority asking how a Keycloak deployment protects personal data will look for records that show the configuration, the access paths and the monitoring as they actually run. The cards below cover the artifacts to keep, how to keep each one current, and the retention decisions that remain with the controller.

Exported realm and user profile configuration

Keep a versioned export of each realm, including the user profile definition that sets which attributes exist, which are required and who can see or edit them. This shows Article 25(2) minimization at the schema level, since an auditor can compare declared attributes with what the processing needs. Re-export after every change and store the export in version control so each change has an author and a date. Check that no unused personal attributes remain in the profile.

Keycloak docs

Admin and event logs with retention

Record admin console and Administration REST API actions, along with login and failure events, and keep them somewhere the realm administrators cannot quietly edit. These logs support Article 32(1) measures on access control and help answer who viewed or changed personal data. Login failures are persisted to the database by default in Keycloak 26.8, so confirm what your deployment stores and for how long. The controller decides the retention period, and the period should match the purpose of the logs.

TLS and reverse proxy configuration

Keep the TLS settings, certificate inventory and reverse proxy rules that protect personal data in transit between users, the proxy and Keycloak. Keycloak's production guidance calls for TLS on all communication and path restrictions at the proxy, so the configuration files are the primary evidence. Store them with the change history and record each certificate renewal. Confirm that the proxy blocks admin paths from public access.

Production guide

Hostname and admin endpoint separation

Document that the admin console and Administration REST API are served on a different hostname or context path from the public frontend URLs. Auditors look for this split because it narrows who can reach the most sensitive functions of the identity store. Record the hostnames, the network paths that reach them and the test that confirms a public request to an admin path fails. Review the record whenever DNS, ingress or proxy rules change.

Metrics and monitoring records

Keep the metrics scrape configuration, alert rules and the dashboards or alerts that show availability and failure trends for the identity service. Enable metrics with --metrics-enabled=true and restrict the management interface so only the monitoring system reaches it. These records show that the controller can detect and respond to security incidents affecting personal data, which supports both Article 32(1) and the breach notification duties in Articles 33 and 34. Decide how long alert history and metric data are kept.

Metrics guide

Records of processing entry for Article 32(1)

Maintain the records of processing entry for the identity system with a general description of the Article 32(1) measures, as Article 30 expects. Link it to the exported configuration, the log retention decision and the hosting location so the description matches what the system does. Review the entry on every Keycloak upgrade, because the measures it describes can change between releases. The EDPB expects the measures to be reviewed regularly for effectiveness, so set a review date and record the outcome.

GDPR text

Where hosting location changes the GDPR transfer analysis

Keycloak running on servers, virtual machines or a Kubernetes cluster in data centers that you operate or lease inside the European Economic Area is the simplest case for transfers. Personal data stored and accessed only from inside the EEA does not, by itself, create a transfer under the EDPB's approach. The analysis still has to cover who can reach the systems from outside the EEA, because remote access counts as a transfer even when the data only appears on a screen.

  • Administrator access from abroad: Support staff or contractors in a third country who log in to the admin console or the database host are a transfer under EDPB Guidelines 05/2021, even if they only view records.
  • Backups and disaster recovery sites: Replicas or backup copies stored outside the EEA count as storage outside the EEA and need the same review as the primary site.
  • Logs and metrics exports: Event logs and Prometheus metrics that contain user identifiers and are shipped to an observability service in another country should be treated as personal data flows.
  • Upstream identity providers: Brokering to an external identity provider or social login outside the EEA sends user data abroad during sign-in, which needs its own analysis.
  • Vendor support channels: Remote troubleshooting sessions by a vendor located in a third country must be assessed the same way as any other remote access.

Confirm with your data protection officer or counsel which remote access paths exist today, and document them in your records of processing.

Configuration sequence for a GDPR-oriented Keycloak

This sequence turns the GDPR Article 25 and 32 duties for identity records into concrete Keycloak settings, in an order that lets each later step rely on the decisions made earlier. Confirm every setting name and default against the Keycloak release you deploy, because the project changes behavior between minor releases.

  1. Inventory personal data in identity records

    The controller's privacy or compliance lead, with the identity team, lists every personal data field Keycloak will hold: usernames, email addresses, names, phone numbers for OTP or recovery, login and event history, federated attributes from directories, and any custom attributes. For each field, record the purpose, the lawful basis as set by the controller, the retention period, and which roles can read it. Done means a signed inventory that the processing record in the final step can cite.

  2. Set user profile and token scope

    The identity team removes or stops collecting fields the inventory does not justify, configures the declarative user profile so that only needed attributes are required or editable, and limits which claims each client receives through client scopes and protocol mappers. Access tokens and ID tokens should carry only the claims a relying application needs for its purpose. Confirm in your release how user profile and client scope configuration are exposed, then export the realm and review each client's mappers. Done means a test login for each client shows only the expected claims.

  3. Configure TLS and reverse proxy path restrictions

    The platform team enables TLS for all communication to and from Keycloak, places a reverse proxy in front of it, and allows only the public paths that applications and the login flow require. Confirm the proxy and TLS options against the production configuration guide for your release. Done means an external scan or proxy test shows that administrative and management paths are not reachable from the public frontend, and that plaintext HTTP is refused.

  4. Separate the admin hostname

    The platform team exposes the admin console and the Administration REST API on a different hostname or context path from the public frontend URLs, and restricts that hostname to administrator networks or VPN access. The production guide calls for this separation. Done means the admin endpoints fail from an unapproved network and succeed from the approved administrator network, and the frontend hostname serves only login and public endpoints.

  5. Enable metrics and event logging

    The operations team starts Keycloak with metrics enabled on the management interface so that Prometheus-format data is available at the metrics path, and turns on login and admin event storage so that authentication and administrative changes can be reviewed. Confirm the exact flags and event types in your release, and decide how long events are kept, since that retention is itself personal data processing. Done means a scrape returns data and a test login and a test admin change both appear in the event records.

  6. Define self-service account deletion and its approval path

    The identity owner decides whether users can delete their own accounts from the account console, and if so, whether deletion takes effect immediately or waits for an administrator to approve it. The approval path should cover which requests need a second person, how a request is recorded, and how linked data such as sessions, credentials and events is handled. Confirm the account deletion options available in your release and test them in a non-production realm. Done means a documented procedure exists and a test deletion removes the account and its active sessions as the procedure states.

  7. Choose a supported database and synchronous replication

    The platform team selects one of the production databases the Keycloak database guide supports, and for a highly available design, uses a database with synchronous replication as the high availability documentation requires for both supported multi-site and single-cluster designs. Set schema migration to a deliberate mode, and do not rely on the development file database. Done means the database version is on the supported list for your release, failover has been tested, and the backup and restore procedure has been rehearsed.

  8. Document the Article 30 record entry

    The privacy lead writes the Keycloak entry in the record of processing activities, describing the categories of personal data from the inventory, the purposes, the retention periods, the recipients, any transfers, and a general description of the Article 32(1) measures in place: TLS, admin separation, access restriction, logging and database resilience. The entry should point to the exported configuration and test evidence from the earlier steps. Done means the record is approved, dated, and reviewed on a schedule the controller sets, since the EDPB expects measures to be reviewed regularly.

What Keycloak does not cover for GDPR

Keycloak supplies technical controls for identity records, but Articles 25 and 32 are met by an organization-wide program. The cards below cover the obligations that sit outside the identity server and remain with the controller, whatever the configuration.

Lawful basis and purpose definition

Keycloak stores whatever attributes you choose to collect, but it cannot decide why they are processed. Before you model user profiles, document the lawful basis and purpose for each attribute, such as login, role assignment or audit. Check that every custom attribute and token claim maps to a stated purpose, because Article 25(2) limits processing to what each purpose requires.

GDPR text

Retention and erasure downstream

Deleting a user in Keycloak does not delete copies in connected applications, data warehouses, logs, helpdesk tools or backups. Map every system that receives identity data from Keycloak, including event and audit stores, and define how each one handles deletion and backup expiry. Confirm which Keycloak event types you store and for how long, since login and admin events can hold personal data.

Breach notification under Articles 33 and 34

Keycloak can record login failures, admin changes and session activity, but deciding whether a breach is reportable is a controller decision with a deadline. Build a runbook that uses Keycloak logs and metrics to scope an incident, then routes the assessment to your privacy and legal teams. Test the process, because the supervisory authority and affected individuals must be told within the time limits the articles set.

Data subject request handling

Access, rectification, erasure and portability requests reach the identity platform, but the response spans several systems. Define who verifies the requester, which Keycloak fields and sessions are exported or changed, and how the response is recorded. Confirm that your procedure covers linked identity provider records and federated attributes that Keycloak does not own.

Processor contracts and transfer assessments

A self-hosted Keycloak keeps data in your chosen location, but support vendors, managed hosting providers, email relays and cloud operators may still process personal data. Hosting in your own infrastructure does not remove the need for a processor contract under Article 28 or a transfer impact assessment where remote access or storage occurs outside the EEA. Ask each provider for written commitments on access from third countries before they touch identity data.

Regular effectiveness reviews

EDPB Guidelines 4/2019 expect controllers to review whether chosen measures remain effective, and that duty applies to systems installed before the GDPR. Schedule periodic reviews of Keycloak realm settings, retention periods, admin access and minimization choices, and record each review and its outcome. Keycloak upgrades and new attributes should trigger a review, not wait for the calendar.

EDPB Guidelines 4/2019

Self-service account deletion and processing records in practice

Self-service deletion in Keycloak is only as complete as the identity records it can reach, so the first decision is which account data users can change themselves and which must go through an administrator. Users manage their own profile, credentials, sessions and linked accounts in the account console, but the realm's user profile settings decide which attributes are editable and which are visible. Confirm in the deployed version whether account deletion is exposed to end users at all, since the account console does not offer it by default and a custom account theme or an admin-driven workflow usually provides it. Deletion also needs a clear answer for federated and brokered users. A user imported from LDAP or Active Directory, or one who signed in through an upstream identity provider, may still exist in the source directory, and Keycloak removing its local copy does not remove the upstream record. A user who signs in again through the same broker can be recreated, so the deletion workflow has to disable or remove the upstream link and the upstream account where the organization controls it.

Deleted identities still live in other places. Applications keep their own user tables, audit logs, session stores and caches, and backups hold copies of the Keycloak database for their retention period. A deletion that leaves an application account pointing to a removed subject identifier leaves orphaned personal data, while a restore from an older backup can bring a deleted account back. Plan a reconciliation step that removes or pseudonymizes application records keyed by the Keycloak sub claim, and define a backup retention period that stops restored accounts from reappearing. Article 25(2) also expects storage periods and accessibility to be limited by default, so the deletion design belongs in the same review as token claims and profile minimization.

The processing record under Article 30 should describe the Article 32(1) measures in general terms, and for Keycloak this section is where that description gets concrete. Record the realm and hosting location, the admin and account console access model, the event and admin event retention, the backup and restore procedure, the deletion and reconciliation steps, and the owner of each control. Review the record whenever the Keycloak version changes, because release notes such as those for the 26.8 line change default behavior, including login failure persistence. Before relying on the record, verify in your deployed version which account console features are enabled, how brokered and federated accounts are handled on deletion, whether backups honor your retention rule, and whether a test deletion removes data from every application that holds a copy.

Keycloak GDPR compliance questions buyers ask before hiring help

What drives the cost of a GDPR-oriented Keycloak build?

Scope drives cost most: how many realms, applications and user populations sit behind Keycloak, how many upstream identity providers or directories must be federated, and how much of the user profile and token design needs to be reviewed against Articles 25 and 32. Hosting also matters, since a deployment in your own data center or a restricted network adds infrastructure work that a cloud deployment may not. Cost components are the discovery and data mapping, the configuration and hardening build, the evidence pack for your records of processing, and any testing you commission. Build work is one-time, while upgrades, patching and periodic review of measures recur. Ask any quote to list each item separately so you can see what is one-time and what your own team will run afterward.

How long does a GDPR-focused Keycloak engagement take?

Duration depends on the same scope and hosting choices that set cost, so the honest answer is that a written scope is the only reliable basis for a timeline. A single realm with one or two applications and a clean hosting environment is a much smaller job than several realms, federated directories and a high availability design across sites. Hosting constraints such as air-gapped networks, approval steps for new infrastructure, or database standards add time before configuration starts. Ask for the milestones, the dependencies on your teams, and the point at which the evidence pack is delivered. Any fixed-scope proposal should state its timeline in writing before work begins.

What does the work need from our security, privacy and infrastructure teams?

Each team owns a different part of the decision. Privacy or data protection staff need to confirm which personal data identity records hold, why each attribute is needed, how long accounts and login events are kept, and who may see them. Security staff set the access control model for administrators, the authentication policy, logging requirements and the risk picture under Article 32(2). Infrastructure teams provide the hosting location, network paths, TLS certificates, database and backup arrangements, and the reverse proxy configuration that keeps the admin console off public hostnames. Agree on named owners and review dates early, because the records of processing need decisions that only your organization can make.

Can an internal team implement GDPR-related Keycloak controls alone?

Often yes, if the team already runs identity or platform services and has time to read the upgrading and production guides in detail. Keycloak is open source under Apache 2.0, so no license purchase is needed to start, and the documentation covers TLS, reverse proxy paths, database choice and metrics. The harder parts are the legal mapping of personal data to Articles 25 and 30, the independent review of the chosen measures, and keeping pace with minor releases, which the project plans four times a year. Teams without recent Keycloak experience usually benefit from an outside review of the design before go-live. Decide which parts you will own for the long term before you start.

Does Keycloak certify that we comply with the GDPR?

No. Keycloak is software, and the GDPR does not provide certificates or attestations for products. The GDPR requires no audit, attestation or certificate, and certification under Article 42 is voluntary, issued by accredited bodies or supervisory authorities for at most three years, and does not reduce the controller's or processor's responsibility. What Keycloak provides is a set of configurable measures, such as access controls, session and credential settings, event logging and self-hosting, that you can describe in your records of processing and assess under Article 32. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports or certifications.

What changes if we use an EU processor to run Keycloak?

Using an EU-based processor does not by itself move data outside the EU, but the processor's own exposure matters. EDPB Guidelines 05/2021 say that an EU processor subject to third-country law with extraterritorial effect is not itself a transfer, but complying with a third-country authority request would be, so you should assess that exposure before engaging the processor. Remote access from a third country, even only displaying data on a screen for support, also counts as a transfer under those guidelines. Ask the processor where administrators sit, who can access identity data and logs, which law governs its contracts, and how it responds to foreign authority requests. Keep the contract, data location and support access in your records of processing.

Which parts of the work are one-time and which recur?

The first build covers data mapping, configuration of realms, clients, token contents and admin access, hosting setup and the initial evidence pack. Those items are usually one-time, though they should be revisited when a new application or identity source is added. Recurring work includes applying minor releases, checking the upgrading notes for each version, reviewing administrator accounts, reviewing the retention settings for login events, and repeating the review of measures that the EDPB Guidelines 4/2019 require on a regular basis. Ask for an operating model that lists who performs each recurring task and how often, so the cost of running Keycloak is visible from the start.

How DeployOpen scopes and delivers GDPR-oriented Keycloak work

DeployOpen plans, implements, hardens, documents and supports self-hosted Keycloak inside your own cloud accounts, data centers or air-gapped networks, so the personal data in identity records stays where your controls apply. We prepare the configuration, records and evidence your compliance and security teams need for Article 25 and Article 32 reviews. We do not issue audit reports or certifications; independent auditors and certification bodies do.

How we scope

  • Written scope lists the realms, clients, user federation sources and identity brokers that hold personal data.
  • Data inventory maps each user attribute, token claim and event log field to a stated processing purpose.
  • Hosting location, backup location and administrator locations are recorded in the scope before any build starts.

How we build

  • Configure user profiles and token mappers so only attributes each application needs are issued.
  • Set admin console and Administration REST API on a separate hostname, with TLS on all communication behind a reverse proxy.
  • Enable self-service account deletion and event retention settings, then test them against the documented processing purposes.

How we hand over

  • Deliver a processing record input covering the Article 32(1) measures in place, written for your records of processing.
  • Provide a configuration baseline, admin access runbook and a list of settings to review on a set schedule.
  • Walk your security, privacy and platform teams through the evidence so they can answer internal and auditor questions.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Re-review settings after each Keycloak upgrade, since minor releases may introduce changes you need to assess.
  • Confirm with your legal team whether any hosting, backup or remote support access constitutes a transfer under Chapter V.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.