Skip to content

Commit a196c7a

Browse files
zmotsodougkirkley
authored andcommitted
feat: Add support for list of attributes with the same key
Signed-off-by: Douglass Kirkley <doug.kirkley@gmail.com>
1 parent 86424d4 commit a196c7a

39 files changed

+1427
-170
lines changed

api/v1/keycloakclient_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,17 @@ type ServiceAccount struct {
213213
ClientRoles []UserClientRole `json:"clientRoles,omitempty"`
214214

215215
// Attributes is a map of service account attributes.
216+
// Deprecated: Use AttributesV2 instead.
216217
// +nullable
217218
// +optional
218219
Attributes map[string]string `json:"attributes,omitempty"`
219220

221+
// AttributesV2 is a map of service account attributes.
222+
// this multi-value attributes
223+
// +nullable
224+
// +optional
225+
AttributesV2 map[string][]string `json:"attributesV2,omitempty"`
226+
220227
// Groups is a list of groups assigned to service account
221228
// +nullable
222229
// +optional

api/v1/keycloakrealmidentityprovider_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ type KeycloakRealmIdentityProviderSpec struct {
5959
// +nullable
6060
// +optional
6161
Mappers []IdentityProviderMapper `json:"mappers,omitempty"`
62+
63+
// AdminFineGrainedPermissionsEnabled enable/disable fine-grained admin permissions for an identity provider.
64+
// Feature flag admin-fine-grained-authz:v1 should be enabled in Keycloak server.
65+
// Important: FGAP:V1 Keycloak feature remains in preview and may be deprecated and removed in a future releases.
66+
// +optional
67+
AdminFineGrainedPermissionsEnabled bool `json:"adminFineGrainedPermissionsEnabled,omitempty"`
68+
69+
// Permission is a identity provider permissions configuration
70+
// +nullable
71+
// +optional
72+
Permission *AdminFineGrainedPermission `json:"permission,omitempty"`
6273
}
6374

6475
type IdentityProviderMapper struct {

api/v1/keycloakrealmuser_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,17 @@ type KeycloakRealmUserSpec struct {
5656
Groups []string `json:"groups,omitempty"`
5757

5858
// Attributes is a map of user attributes.
59+
// Deprecated: Use AttributesV2 instead.
5960
// +nullable
6061
// +optional
6162
Attributes map[string]string `json:"attributes,omitempty"`
6263

64+
// AttributesV2 is a map of service account attributes.
65+
// this multi-value attributes
66+
// +nullable
67+
// +optional
68+
AttributesV2 map[string][]string `json:"attributesV2,omitempty"`
69+
6370
// ReconciliationStrategy is a strategy for reconciliation. Possible values: full, create-only.
6471
// Default value: full. If set to create-only, user will be created only if it does not exist. If user exists, it will not be updated.
6572
// If set to full, user will be created if it does not exist, or updated if it exists.

api/v1/zz_generated.deepcopy.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func main() {
308308
os.Exit(1)
309309
}
310310

311-
if err = keycloakrealmidentityprovider.NewReconcile(mgr.GetClient(), h, secretref.NewSecretRef(mgr.GetClient())).
311+
if err = keycloakrealmidentityprovider.NewReconcile(mgr.GetClient(), h).
312312
SetupWithManager(mgr, successReconcileTimeoutValue); err != nil {
313313
setupLog.Error(err, "unable to create keycloak-realm-identity-provider controller")
314314
os.Exit(1)

config/crd/bases/v1.edp.epam.com_keycloakclients.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,19 @@ spec:
613613
attributes:
614614
additionalProperties:
615615
type: string
616-
description: Attributes is a map of service account attributes.
616+
description: |-
617+
Attributes is a map of service account attributes.
618+
Deprecated: Use AttributesV2 instead.
619+
nullable: true
620+
type: object
621+
attributesV2:
622+
additionalProperties:
623+
items:
624+
type: string
625+
type: array
626+
description: |-
627+
AttributesV2 is a map of service account attributes.
628+
this multi-value attributes
617629
nullable: true
618630
type: object
619631
clientRoles:

config/crd/bases/v1.edp.epam.com_keycloakrealmidentityproviders.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ spec:
5050
description: AddReadTokenRoleOnCreate is a flag to add read token
5151
role on create.
5252
type: boolean
53+
adminFineGrainedPermissionsEnabled:
54+
description: |-
55+
AdminFineGrainedPermissionsEnabled enable/disable fine-grained admin permissions for an identity provider.
56+
Feature flag admin-fine-grained-authz:v1 should be enabled in Keycloak server.
57+
Important: FGAP:V1 Keycloak feature remains in preview and may be deprecated and removed in a future releases.
58+
type: boolean
5359
alias:
5460
description: Alias is a alias of identity provider.
5561
type: string
@@ -102,6 +108,26 @@ spec:
102108
type: object
103109
nullable: true
104110
type: array
111+
permission:
112+
description: Permission is a identity provider permissions configuration
113+
nullable: true
114+
properties:
115+
scopePermissions:
116+
description: ScopePermissions mapping of scope and the policies
117+
attached
118+
items:
119+
properties:
120+
name:
121+
type: string
122+
policies:
123+
items:
124+
type: string
125+
type: array
126+
required:
127+
- name
128+
type: object
129+
type: array
130+
type: object
105131
providerId:
106132
description: ProviderID is a provider ID of identity provider.
107133
type: string

config/crd/bases/v1.edp.epam.com_keycloakrealmusers.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ spec:
4747
attributes:
4848
additionalProperties:
4949
type: string
50-
description: Attributes is a map of user attributes.
50+
description: |-
51+
Attributes is a map of user attributes.
52+
Deprecated: Use AttributesV2 instead.
53+
nullable: true
54+
type: object
55+
attributesV2:
56+
additionalProperties:
57+
items:
58+
type: string
59+
type: array
60+
description: |-
61+
AttributesV2 is a map of service account attributes.
62+
this multi-value attributes
5163
nullable: true
5264
type: object
5365
clientRoles:

deploy-templates/crds/v1.edp.epam.com_keycloakclients.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,19 @@ spec:
613613
attributes:
614614
additionalProperties:
615615
type: string
616-
description: Attributes is a map of service account attributes.
616+
description: |-
617+
Attributes is a map of service account attributes.
618+
Deprecated: Use AttributesV2 instead.
619+
nullable: true
620+
type: object
621+
attributesV2:
622+
additionalProperties:
623+
items:
624+
type: string
625+
type: array
626+
description: |-
627+
AttributesV2 is a map of service account attributes.
628+
this multi-value attributes
617629
nullable: true
618630
type: object
619631
clientRoles:

deploy-templates/crds/v1.edp.epam.com_keycloakrealmidentityproviders.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ spec:
5050
description: AddReadTokenRoleOnCreate is a flag to add read token
5151
role on create.
5252
type: boolean
53+
adminFineGrainedPermissionsEnabled:
54+
description: |-
55+
AdminFineGrainedPermissionsEnabled enable/disable fine-grained admin permissions for an identity provider.
56+
Feature flag admin-fine-grained-authz:v1 should be enabled in Keycloak server.
57+
Important: FGAP:V1 Keycloak feature remains in preview and may be deprecated and removed in a future releases.
58+
type: boolean
5359
alias:
5460
description: Alias is a alias of identity provider.
5561
type: string
@@ -102,6 +108,26 @@ spec:
102108
type: object
103109
nullable: true
104110
type: array
111+
permission:
112+
description: Permission is a identity provider permissions configuration
113+
nullable: true
114+
properties:
115+
scopePermissions:
116+
description: ScopePermissions mapping of scope and the policies
117+
attached
118+
items:
119+
properties:
120+
name:
121+
type: string
122+
policies:
123+
items:
124+
type: string
125+
type: array
126+
required:
127+
- name
128+
type: object
129+
type: array
130+
type: object
105131
providerId:
106132
description: ProviderID is a provider ID of identity provider.
107133
type: string

0 commit comments

Comments
 (0)