Google OIDC SSO with Mapping (Google) Groups onto (Kibana) Roles


We're using Elastic Cloud hosted version of the Elastic stack and attempting to integration Google SSO with OIDC.

I have the authentication working and can use role mapping with usernames to map specific users onto Roles in Kibana.

To make this more manageable and consistent with our other systems using Google OIDC, I want to manage role assignment with Google Groups e.g. assign people to 'engineers' group in Google Workplace and have them pick up the equivalent Engineers role in Kibana.

In Google Cloud Console we have the permissions set up correctly to allow the OIDC integration to pull through the groups (and this is working with Pritunl/Hashicorp Vault OK) but I'm struggling to map the groups.

I can find instructions for mapping Azure AD groups but not Google.

In elasticsearch.yml I have this:

                order: 2
                rp.client_id: ""
                rp.response_type: "code"
                rp.requested_scopes: ["openid", "email", ""]
                rp.redirect_uri: ""
                op.issuer: ""
                op.authorization_endpoint: ""
                op.token_endpoint: ""
                op.userinfo_endpoint: ""
                op.jwkset_path: ""
                claims.principal: email
                claims.groups: groups
                claim_patterns.principal: "^([^@]+)@ourdomain\\.tld$"

I've then tried mapping the groups onto roles with this:

    PUT /_xpack/security/role_mapping/oidc_kibana
        "enabled": true,
        "roles": [ "engineers" ],
        "rules" : {
          "all" : [
            {"field" : { "" : "oidc1" }},
            {"field": { "groups": ["engineers"] } }
        "metadata": { "version": 1 }

However the role doesn't appear to be assigned.

If I swap out the groups line to a list of explicit users it works as expected and assigns the Role:

{"field": { "username": ["user1","user2"] } }

Any ideas? Is there a change I need to make in elasticsearch.yml to map the groups returned by Google in the JWT?

The missing part here is how and if Google returns the group memberships in the JWT.

                claims.groups: groups

This configuration tells Elasticsearch that it should try and find a claim that is named groups in the ID Token or in the Userinfo response and get all the values from it and assign it to the groups property of the user representation in elasticsearch, so that you can later do things like

{"field": { "groups": ["engineers"] } }

in your role mappings.

From what I see in , Google's OIDC implementation doesn't support a claim by which it conveys the users group memberships in the context of OpenID Connect, so it appears that you won't be able to do what you're after as groups are not even returned in the IDToken JWT.

Hi Ioannis,

I had assumed Google did return the Groups in their JWT as we got this functionality working ok with Hashicorp Vault product (see OIDC Provider Setup - Auth Methods | Vault by HashiCorp) however. if I'm reading their source code correctly. it looks like they had to write a specific plug-in to pull the Groups via the Google API)

Pritunl also handles Google Groups nicely, mapping these onto their concept of Organisations: Google

So while it is technically possible, it would require more work on Elastic's side to more tightly support Google Workplace. For now I'll have to handle the mapping manually based on username rather than Groups.

Thanks for your help/investigation.