Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Release: Change Requests 2.1.9 Minor update available for module change_requests (2.1.9). Release: Arguments 1.0.12 Minor update available for module arguments (1.0.12). Release: Thunder 8.4.3 Minor update available for distribution thunder (8.4.3). Release: Thunder 8.4.2 Minor update available for distribution thunder (8.4.2). Release: Ágora Transparency Theme 1.0.6 Minor update available for theme agora_theme (1.0.6). Release: OIDC Role Mapping 1.0.0 Initial release available for module oidc_role_mapping (1.0.0)! Module Revived: Commerce Cart Item Count 3.0.1 Module cart_item_count updated after 10 months of inactivity (3.0.1).

OIDC Role Mapping

No security coverage Drupal 11 · not 10 Oidc ecosystem
View on drupal.org

OIDC Role Mapping lets a Drupal site automatically assign Drupal roles to users based on information their login provider sends during Single Sign-On (SSO), instead of an administrator having to manually assign a role to every new user.

If your organization already logs users into Drupal through an external identity provider (such as Keycloak, Azure AD, or another OpenID Connect provider), that provider often already knows what "group" or "role" a person belongs to. For example, editor, manager, or student. This module reads that information from the login token and translates it into the matching Drupal role, automatically, every time the person logs in.

Features

- Adds a "roles claim" setting to a generic OIDC realm: the name of the token field (claim) that contains a user's role information from the identity provider.
- Lets an administrator map individual role values from that claim to specific Drupal roles, using a simple form, no code required.
- Automatically grants the mapped Drupal role(s) to a user's account the moment they log in via that OIDC realm, based on what the claim contains.
- Optionally, automatically removes a previously granted role again if the claim no longer contains the matching value on a later login, keeping Drupal roles in sync with the identity provider over time, rather than only ever adding roles.
- Works as a non-intrusive extension of the OIDC module's existing generic realm plugin, so it does not require patching or modifying that module.

Typical use case: your identity provider already manages who is an "Editor" or "Administrator" through its own groups, and you want Drupal to reflect that automatically, without staff having to separately manage Drupal permissions by hand.

Post-Installation

After enabling the module, go to the configuration of your OIDC realm, and edit the generic realm you want to enable this for. You will now see:

- A Roles claim field, where you enter the name of the claim/token field that carries role information (this depends on how your identity provider is set up).
- A Role mapping section listing your site's roles, where you fill in which claim value should grant each role.
- A Remove roles checkbox, to control whether roles should also be revoked automatically when no longer present in the claim.

Leave the "Roles claim" field empty to disable role mapping for that realm entirely.

Additional Requirements

- OIDC: this module extends OIDC's generic realm plugin and does not work without it.
- External Authentication: used to detect the login event that triggers role synchronization.

No additional libraries or external services beyond your existing OpenID Connect identity provider are required.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Aug 2026
Latest release
1 hour ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 11 Aug 31, 2026
1.0.0 Stable 11 Aug 31, 2026