Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add api endpoints to get idp field values#16063

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jaaydenh merged 4 commits intomainfromjaaydenh/idp-field-values-api
Jan 8, 2025

Conversation

jaaydenh
Copy link
Contributor

@jaaydenhjaaydenh commentedJan 7, 2025
edited
Loading

@jaaydenhjaaydenh marked this pull request as ready for reviewJanuary 7, 2025 22:37
@jaaydenhjaaydenh requested a review fromEmyrkJanuary 7, 2025 22:37
Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

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

LG, some minor tweaks

}

func (c*Client)GetIDPSyncFieldValues(ctx context.Context,claimFieldstring) ([]string,error) {
res,err:=c.Request(ctx,http.MethodGet,fmt.Sprintf("/api/v2/settings/idpsync/field-values?claimField=%s",claimField),nil)
Copy link
Member

Choose a reason for hiding this comment

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

claimField=%s will not url encode special characters.

Suggested change
res,err:=c.Request(ctx,http.MethodGet,fmt.Sprintf("/api/v2/settings/idpsync/field-values?claimField=%s",claimField),nil)
qv:=url.Values{}
qv.Add("claimField",claimField)
res,err:=c.Request(ctx,http.MethodGet,fmt.Sprintf("/api/v2/settings/idpsync/field-values?%s",qv.Encode()),nil)

Example:https://go.dev/play/p/zN-CJsgWkz0

jaaydenh reacted with thumbs up emoji
Comment on lines 398 to 400
ctx:=r.Context()

fields,err:=api.Database.OIDCClaimFieldValues(ctx, database.OIDCClaimFieldValuesParams{
Copy link
Member

Choose a reason for hiding this comment

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

just do theclaimField parsing in here.

Suggested change
ctx:=r.Context()
fields,err:=api.Database.OIDCClaimFieldValues(ctx, database.OIDCClaimFieldValuesParams{
ctx:=r.Context()
claimField:=r.URL.Query().Get("claimField")
fields,err:=api.Database.OIDCClaimFieldValues(ctx, database.OIDCClaimFieldValuesParams{

Also you should defend against an empty string here.

if claimField == "" {httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{Message: "claimField query parameter is required",})return}

jaaydenh reacted with thumbs up emoji
@jaaydenhjaaydenh requested a review fromEmyrkJanuary 8, 2025 18:50
@jaaydenhjaaydenh merged commit6ca1e59 intomainJan 8, 2025
32 checks passed
@jaaydenhjaaydenh deleted the jaaydenh/idp-field-values-api branchJanuary 8, 2025 21:07
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@EmyrkEmyrkEmyrk approved these changes

Assignees

@jaaydenhjaaydenh

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jaaydenh@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp