Skip to content

Conversation

@pixeldrew
Copy link

@pixeldrew pixeldrew commented Oct 24, 2025

Description

Google id token uses the google id as username. I have internal systems that the username should match employee id which is my mapped into my google workspace directory as "Organization Id". I needed to have a way to retrieve that and add it to a header as it's not in the id token either.

Motivation and Context

This allows a preferred username to be retrieved from the directory as "organization" id instead of google's user id. This is similar to how you might use MS Entra's onpremid to map to local AD usernames. I added a config change to enable this. If the user does not have an organization id mapped, the auth service will 500, i'm open to changing this behavior.

Due to the way the scope permissions are iterated over, it currently only works if you have both https://www.googleapis.com/auth/admin.directory.group.member.readonly and https://www.googleapis.com/auth/admin.directory.user.readonly.

Made the scope required for AdminApiUser as a config option.

How Has This Been Tested?

Tested locally and in production.

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.
  • I have written tests for my code changes.

@pixeldrew pixeldrew changed the title feat: added organizationId/employee id as preferred username feat: google provider added organizationId/employee id as preferred username Oct 24, 2025
@pixeldrew pixeldrew force-pushed the add-preferred-username-google branch from b385f87 to d539465 Compare October 25, 2025 17:41
@pixeldrew pixeldrew marked this pull request as ready for review October 25, 2025 17:42
@pixeldrew pixeldrew requested a review from a team as a code owner October 25, 2025 17:42
@pixeldrew pixeldrew force-pushed the add-preferred-username-google branch from d539465 to 1a32885 Compare October 25, 2025 17:42
Copy link
Member

@tuunit tuunit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run make generate to update the alpha docs

@tuunit tuunit changed the title feat: google provider added organizationId/employee id as preferred username feat: add option to use organization id for preferred username in Google Provider Oct 28, 2025
@pixeldrew pixeldrew force-pushed the add-preferred-username-google branch 3 times, most recently from 7e82026 to e73b0c2 Compare October 28, 2025 13:51
@pixeldrew pixeldrew requested a review from tuunit October 28, 2025 14:00
@pixeldrew pixeldrew force-pushed the add-preferred-username-google branch 4 times, most recently from c37d6b6 to 4b6d7a2 Compare October 28, 2025 14:24
@tuunit
Copy link
Member

tuunit commented Nov 3, 2025

@pixeldrew please check the linting issues in the workflow or run make lint locally :)

Rest looks good to me, after the linting issues are fixed this is ready to be merged

Signed-off-by: Drew Foehn <drew@pixelburn.net>
@pixeldrew pixeldrew force-pushed the add-preferred-username-google branch from 596ab79 to 84f4021 Compare November 4, 2025 02:01
@pixeldrew
Copy link
Author

@pixeldrew please check the linting issues in the workflow or run make lint locally :)

Rest looks good to me, after the linting issues are fixed this is ready to be merged

fixed the linting issues and regenerated the docs again, apologies for the rework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants