Skip to content

Commit 2fb6ec2

Browse files
authored
feat: add consent required flag on saml clients (#1130)
Signed-off-by: frpicard <[email protected]>
1 parent 3d98f19 commit 2fb6ec2

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

docs/resources/saml_client.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ resource "keycloak_saml_client" "saml_client" {
6969
- `browser_id` - (Optional) Browser flow id, (flow needs to exist)
7070
- `direct_grant_id` - (Optional) Direct grant flow id (flow needs to exist)
7171
- `always_display_in_console` - (Optional) Always list this client in the Account UI, even if the user does not have an active session.
72+
- `consent_required` - (Optional) When `true`, users have to consent to client access. Defaults to `false`.
7273
- `extra_config` - (Optional) A map of key/value pairs to add extra configuration attributes to this client. This can be used for custom attributes, or to add configuration attributes that is not yet supported by this Terraform provider. Use this attribute at your own risk, as s may conflict with top-level configuration attributes in future provider updates.
7374

7475
## Attributes Reference

keycloak/saml_client.go

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type SamlClient struct {
5858
MasterSamlProcessingUrl string `json:"adminUrl"`
5959

6060
FullScopeAllowed bool `json:"fullScopeAllowed"`
61+
ConsentRequired bool `json:"consentRequired"`
6162

6263
AlwaysDisplayInConsole bool `json:"alwaysDisplayInConsole"`
6364

provider/data_source_keycloak_saml_client.go

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ func dataSourceKeycloakSamlClient() *schema.Resource {
6161
Type: schema.TypeBool,
6262
Computed: true,
6363
},
64+
"consent_required": {
65+
Type: schema.TypeBool,
66+
Computed: true,
67+
},
6468
"front_channel_logout": {
6569
Type: schema.TypeBool,
6670
Computed: true,

provider/resource_keycloak_saml_client.go

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ func resourceKeycloakSamlClient() *schema.Resource {
9494
Optional: true,
9595
Default: true,
9696
},
97+
"consent_required": {
98+
Type: schema.TypeBool,
99+
Optional: true,
100+
Computed: true,
101+
},
97102
"front_channel_logout": {
98103
Type: schema.TypeBool,
99104
Optional: true,
@@ -321,6 +326,7 @@ func mapToSamlClientFromData(data *schema.ResourceData) *keycloak.SamlClient {
321326
BaseUrl: data.Get("base_url").(string),
322327
MasterSamlProcessingUrl: data.Get("master_saml_processing_url").(string),
323328
FullScopeAllowed: data.Get("full_scope_allowed").(bool),
329+
ConsentRequired: data.Get("consent_required").(bool),
324330
AlwaysDisplayInConsole: data.Get("always_display_in_console").(bool),
325331
Attributes: samlAttributes,
326332
}
@@ -378,6 +384,7 @@ func mapToDataFromSamlClient(ctx context.Context, data *schema.ResourceData, cli
378384
data.Set("logout_service_redirect_binding_url", client.Attributes.LogoutServiceRedirectBindingURL)
379385
data.Set("full_scope_allowed", client.FullScopeAllowed)
380386
data.Set("login_theme", client.Attributes.LoginTheme)
387+
data.Set("consent_required", client.ConsentRequired)
381388
data.Set("always_display_in_console", client.AlwaysDisplayInConsole)
382389

383390
if canonicalizationMethod, ok := mapKeyFromValue(keycloakSamlClientCanonicalizationMethods, client.Attributes.CanonicalizationMethod); ok {

0 commit comments

Comments
 (0)