Skip to content

chore: refactor oidc group and role sync to methods #10918

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

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Nov 28, 2023

The 'userOIDC' method body was getting unwieldy.
I think there is a good way to redesign the flow, but I do not want to undertake that at this time.
The easy win is just to move some LoC to other methods and cleanup the main method.

The 'userOIDC' method body was getting unwieldy.
I think there is a good way to redesign the flow, but
I do not want to undertake that at this time.
The easy win is just to move some LoC to other methods
and cleanup the main method.
@Emyrk Emyrk requested a review from coadler November 28, 2023 15:31
Comment on lines +928 to +942
usingGroups, groups, err := api.oidcGroups(ctx, mergedClaims)
if err != nil {
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "Failed to sync groups from OIDC claims",
Detail: err.Error(),
})
return
}

roles, ok := api.oidcRoles(ctx, rw, r, mergedClaims)
if !ok {
// oidcRoles writes the error to the response writer for us.
return
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems odd that oidcRoles would write to the response but oidcGroups doesn't. Is there a reason oidcGroups can't?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually prefer neither write to the response, but Groups had a response that was hard to put in an error.

@Emyrk Emyrk merged commit cb6c0f3 into main Nov 29, 2023
@Emyrk Emyrk deleted the stevenmasley/oidc_cleanup branch November 29, 2023 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants