Skip to content

Commit

Permalink
feat: add id parameter to create oauth2-client cli (#3725)
Browse files Browse the repository at this point in the history
Fixes #3724
  • Loading branch information
inigohu authored Apr 26, 2024
1 parent 017ebae commit b372fd2
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/cmd_create_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
flagClientAllowedCORSOrigin = "allowed-cors-origin"
flagClientAudience = "audience"
flagClientBackchannelLogoutCallback = "backchannel-logout-callback"
flagClientId = "id"
flagClientName = "name"
flagClientClientURI = "client-uri"
flagClientContact = "contact"
Expand Down Expand Up @@ -86,8 +87,11 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags ` + "`--pgp-key`" +
}

secret := flagx.MustGetString(cmd, flagClientSecret)
cl := clientFromFlags(cmd)
cl.ClientId = pointerx.Ptr(flagx.MustGetString(cmd, flagClientId))

//nolint:bodyclose
client, _, err := m.OAuth2Api.CreateOAuth2Client(cmd.Context()).OAuth2Client(clientFromFlags(cmd)).Execute()
client, _, err := m.OAuth2Api.CreateOAuth2Client(cmd.Context()).OAuth2Client(cl).Execute()
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand All @@ -111,5 +115,6 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags ` + "`--pgp-key`" +
},
}
registerClientFlags(cmd.Flags())
cmd.Flags().String(flagClientId, "", "Provide the client's id.")
return cmd
}
Loading

0 comments on commit b372fd2

Please sign in to comment.