Skip to content

Commit 65af2c4

Browse files
[CLI-3479] Union of Pools Identity Provider (#3065)
1 parent a03d75b commit 65af2c4

14 files changed

+121
-46
lines changed

cmd/lint/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ var vocabWords = []string{
252252
"jit",
253253
"jsonschema",
254254
"jwks",
255+
"JWT",
255256
"kafka",
256257
"kek",
257258
"keychain",

internal/iam/command_provider.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ type identityProviderCommand struct {
1414
}
1515

1616
type identityProviderOut struct {
17-
Id string `human:"ID" serialized:"id"`
18-
Name string `human:"Name" serialized:"name"`
19-
Description string `human:"Description" serialized:"description"`
20-
IssuerUri string `human:"Issuer URI" serialized:"issuer_uri"`
21-
JwksUri string `human:"JWKS URI" serialized:"jwks_uri"`
17+
Id string `human:"ID" serialized:"id"`
18+
Name string `human:"Name" serialized:"name"`
19+
Description string `human:"Description" serialized:"description"`
20+
IdentityClaim string `human:"Identity Claim,omitempty" serialized:"identity_claim,omitempty"`
21+
IssuerUri string `human:"Issuer URI" serialized:"issuer_uri"`
22+
JwksUri string `human:"JWKS URI" serialized:"jwks_uri"`
2223
}
2324

2425
func newProviderCommand(prerunner pcmd.PreRunner) *cobra.Command {
@@ -42,11 +43,12 @@ func newProviderCommand(prerunner pcmd.PreRunner) *cobra.Command {
4243
func printIdentityProvider(cmd *cobra.Command, provider identityproviderv2.IamV2IdentityProvider) error {
4344
table := output.NewTable(cmd)
4445
table.Add(&identityProviderOut{
45-
Id: provider.GetId(),
46-
Name: provider.GetDisplayName(),
47-
Description: provider.GetDescription(),
48-
IssuerUri: provider.GetIssuer(),
49-
JwksUri: provider.GetJwksUri(),
46+
Id: provider.GetId(),
47+
Name: provider.GetDisplayName(),
48+
Description: provider.GetDescription(),
49+
IdentityClaim: provider.GetIdentityClaim(),
50+
IssuerUri: provider.GetIssuer(),
51+
JwksUri: provider.GetJwksUri(),
5052
})
5153
return table.Print()
5254
}

internal/iam/command_provider_create.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func (c *identityProviderCommand) newCreateCommand() *cobra.Command {
2626
cmd.Flags().String("issuer-uri", "", "URI of the identity provider issuer.")
2727
cmd.Flags().String("jwks-uri", "", "JWKS (JSON Web Key Set) URI of the identity provider.")
2828
cmd.Flags().String("description", "", "Description of the identity provider.")
29+
cmd.Flags().String("identity-claim", "", "The JSON Web Token (JWT) claim to extract the authenticating identity to Confluent resources from Registered Claim Names.")
2930
pcmd.AddContextFlag(cmd, c.CLICommand)
3031
pcmd.AddOutputFlag(cmd)
3132

@@ -51,11 +52,17 @@ func (c *identityProviderCommand) create(cmd *cobra.Command, args []string) erro
5152
return err
5253
}
5354

55+
identityClaim, err := cmd.Flags().GetString("identity-claim")
56+
if err != nil {
57+
return err
58+
}
59+
5460
createIdentityProvider := identityproviderv2.IamV2IdentityProvider{
55-
DisplayName: identityproviderv2.PtrString(args[0]),
56-
Description: identityproviderv2.PtrString(description),
57-
Issuer: identityproviderv2.PtrString(issuerUri),
58-
JwksUri: identityproviderv2.PtrString(jwksUri),
61+
DisplayName: identityproviderv2.PtrString(args[0]),
62+
Description: identityproviderv2.PtrString(description),
63+
IdentityClaim: identityproviderv2.PtrString(identityClaim),
64+
Issuer: identityproviderv2.PtrString(issuerUri),
65+
JwksUri: identityproviderv2.PtrString(jwksUri),
5966
}
6067
provider, err := c.V2Client.CreateIdentityProvider(createIdentityProvider)
6168
if err != nil {

internal/iam/command_provider_list.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ func (c *identityProviderCommand) list(cmd *cobra.Command, _ []string) error {
3030
list := output.NewList(cmd)
3131
for _, provider := range identityProviders {
3232
list.Add(&identityProviderOut{
33-
Id: provider.GetId(),
34-
Name: provider.GetDisplayName(),
35-
Description: provider.GetDescription(),
36-
IssuerUri: provider.GetIssuer(),
37-
JwksUri: provider.GetJwksUri(),
33+
Id: provider.GetId(),
34+
Name: provider.GetDisplayName(),
35+
Description: provider.GetDescription(),
36+
IdentityClaim: provider.GetIdentityClaim(),
37+
IssuerUri: provider.GetIssuer(),
38+
JwksUri: provider.GetJwksUri(),
3839
})
3940
}
4041
return list.Print()

internal/iam/command_provider_update.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ func (c *identityProviderCommand) newUpdateCommand() *cobra.Command {
2626

2727
cmd.Flags().String("name", "", "Name of the identity provider.")
2828
cmd.Flags().String("description", "", "Description of the identity provider.")
29+
cmd.Flags().String("identity-claim", "", "The JSON Web Token (JWT) claim to extract the authenticating identity to Confluent resources from Registered Claim Names.")
2930
pcmd.AddContextFlag(cmd, c.CLICommand)
3031
pcmd.AddOutputFlag(cmd)
3132

32-
cmd.MarkFlagsOneRequired("name", "description")
33+
cmd.MarkFlagsOneRequired("name", "description", "identity-claim")
3334

3435
return cmd
3536
}
@@ -45,10 +46,18 @@ func (c *identityProviderCommand) update(cmd *cobra.Command, args []string) erro
4546
return err
4647
}
4748

49+
identityClaim, err := cmd.Flags().GetString("identity-claim")
50+
if err != nil {
51+
return err
52+
}
53+
4854
update := identityproviderv2.IamV2IdentityProvider{Id: identityproviderv2.PtrString(args[0])}
4955
if name != "" {
5056
update.DisplayName = identityproviderv2.PtrString(name)
5157
}
58+
if identityClaim != "" {
59+
update.IdentityClaim = identityproviderv2.PtrString(identityClaim)
60+
}
5261
if description != "" {
5362
update.Description = identityproviderv2.PtrString(description)
5463
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
+----------------+-------------------------------------------------+
2+
| ID | op-67890 |
3+
| Name | okta-with-identity-claim |
4+
| Description | new description. |
5+
| Identity Claim | claims.sub |
6+
| Issuer URI | https://company.new-provider.com |
7+
| JWKS URI | https://company.new-provider.com/oauth2/v1/keys |
8+
+----------------+-------------------------------------------------+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
op-12345 identity-provider: providing identities.
22
op-abc another-provider: providing identities.
3+
op-67890 okta-with-identity-claim: new description.
34
:4
45
Completion ended with directive: ShellCompDirectiveNoFileComp
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
+----------------+-------------------------------------------------+
2+
| ID | op-67890 |
3+
| Name | okta-with-identity-claim |
4+
| Description | new description. |
5+
| Identity Claim | claims.sub |
6+
| Issuer URI | https://company.new-provider.com |
7+
| JWKS URI | https://company.new-provider.com/oauth2/v1/keys |
8+
+----------------+-------------------------------------------------+
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
ID | Name | Description | Issuer URI | JWKS URI
2-
-----------+-------------------+-----------------------+------------------------------+----------------------------------------------
3-
op-12345 | identity-provider | providing identities. | https://company.provider.com | https://company.provider.com/oauth2/v1/keys
4-
op-abc | another-provider | providing identities. | https://company.provider.com | https://company.provider.com/oauth2/v1/keys
1+
ID | Name | Description | Identity Claim | Issuer URI | JWKS URI
2+
-----------+--------------------------+-----------------------+----------------+----------------------------------+--------------------------------------------------
3+
op-12345 | identity-provider | providing identities. | | https://company.provider.com | https://company.provider.com/oauth2/v1/keys
4+
op-67890 | okta-with-identity-claim | new description. | claims.sub | https://company.new-provider.com | https://company.new-provider.com/oauth2/v1/keys
5+
op-abc | another-provider | providing identities. | | https://company.provider.com | https://company.provider.com/oauth2/v1/keys
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
+----------------+-------------------------------------------------+
2+
| ID | op-67890 |
3+
| Name | okta-with-identity-claim |
4+
| Description | providing identities with |
5+
| | identity claim. |
6+
| Identity Claim | claims.sub.updated |
7+
| Issuer URI | https://company.new-provider.com |
8+
| JWKS URI | https://company.new-provider.com/oauth2/v1/keys |
9+
+----------------+-------------------------------------------------+

0 commit comments

Comments
 (0)