Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idp] Add email to ID token #17678

Merged
merged 3 commits into from
May 19, 2023
Merged

[idp] Add email to ID token #17678

merged 3 commits into from
May 19, 2023

Conversation

csweichel
Copy link
Contributor

@csweichel csweichel commented May 19, 2023

Description

This PR adds the email claim to the ID tokens produced by the IDP feature.

Related Issue(s)

Fixes #17530

How to test

see unit tests or gp idp token

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • analytics=segment
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

/hold

@csweichel csweichel requested a review from a team May 19, 2023 13:31
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label May 19, 2023
Identities: []*protocol.Identity{
nil,
{Deleted: true, PrimaryEmail: "nonsense@gitpod.io"},
{PrimaryEmail: "correct@gitpod.io"},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{PrimaryEmail: "correct@gitpod.io"},
{Deleted: false, PrimaryEmail: "correct@gitpod.io"},

I know it's the default, but visually grepping the tests the symmetry makes it easier

components/public-api-server/pkg/apiv1/identityprovider.go Outdated Show resolved Hide resolved
@@ -79,6 +88,9 @@ func (srv *IdentityProviderService) GetIDToken(ctx context.Context, req *connect
userInfo := oidc.NewUserInfo()
userInfo.SetName(user.Name)
userInfo.SetSubject(subject)
if email != "" {
Copy link
Member

Choose a reason for hiding this comment

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

You could drop the if, it would set it to the empty string, which is the default value in the struct anyway - it's omitempty in the JSON struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I like the explicitness of this code though :)

which is a valid claim because it's verified by the original IDP,
and this is not the user-editable value.
@roboquat roboquat merged commit 36905ac into main May 19, 2023
@roboquat roboquat deleted the cw/fix-17530 branch May 19, 2023 14:07
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add email to JWT claims
3 participants