@@ -31,7 +31,7 @@ func TestAccKeycloakOpenidClient_basic(t *testing.T) {
31
31
ImportState : true ,
32
32
ImportStateVerify : true ,
33
33
ImportStateIdPrefix : testAccRealm .Realm + "/" ,
34
- ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" },
34
+ ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" , "exclude_issuer_from_auth_response" },
35
35
},
36
36
},
37
37
})
@@ -55,7 +55,7 @@ func TestAccKeycloakOpenidClient_basic_with_consent(t *testing.T) {
55
55
ImportState : true ,
56
56
ImportStateVerify : true ,
57
57
ImportStateIdPrefix : testAccRealm .Realm + "/" ,
58
- ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" },
58
+ ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" , "exclude_issuer_from_auth_response" },
59
59
},
60
60
},
61
61
})
@@ -331,7 +331,7 @@ func TestAccKeycloakOpenidClient_AccessToken_basic(t *testing.T) {
331
331
ImportState : true ,
332
332
ImportStateVerify : true ,
333
333
ImportStateIdPrefix : testAccRealm .Realm + "/" ,
334
- ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" },
334
+ ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" , "exclude_issuer_from_auth_response" },
335
335
},
336
336
},
337
337
})
@@ -363,7 +363,7 @@ func TestAccKeycloakOpenidClient_ClientTimeouts_basic(t *testing.T) {
363
363
ImportState : true ,
364
364
ImportStateVerify : true ,
365
365
ImportStateIdPrefix : testAccRealm .Realm + "/" ,
366
- ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" },
366
+ ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" , "exclude_issuer_from_auth_response" },
367
367
},
368
368
},
369
369
})
@@ -399,7 +399,7 @@ func TestAccKeycloakOpenidClient_Device_basic(t *testing.T) {
399
399
ImportState : true ,
400
400
ImportStateVerify : true ,
401
401
ImportStateIdPrefix : testAccRealm .Realm + "/" ,
402
- ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" },
402
+ ImportStateVerifyIgnore : []string {"exclude_session_state_from_auth_response" , "exclude_issuer_from_auth_response" },
403
403
},
404
404
},
405
405
})
@@ -519,27 +519,31 @@ func TestAccKeycloakOpenidClient_pkceCodeChallengeMethod(t *testing.T) {
519
519
Check : resource .ComposeTestCheckFunc (
520
520
testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "" ),
521
521
testAccCheckKeycloakOpenidClientHasExcludeSessionStateFromAuthResponse ("keycloak_openid_client.client" , false ),
522
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
522
523
),
523
524
},
524
525
{
525
526
Config : testKeycloakOpenidClient_pkceChallengeMethod (clientId , "plain" ),
526
527
Check : resource .ComposeTestCheckFunc (
527
528
testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "plain" ),
528
529
testAccCheckKeycloakOpenidClientHasExcludeSessionStateFromAuthResponse ("keycloak_openid_client.client" , false ),
530
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
529
531
),
530
532
},
531
533
{
532
534
Config : testKeycloakOpenidClient_pkceChallengeMethod (clientId , "S256" ),
533
535
Check : resource .ComposeTestCheckFunc (
534
536
testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "S256" ),
535
537
testAccCheckKeycloakOpenidClientHasExcludeSessionStateFromAuthResponse ("keycloak_openid_client.client" , false ),
538
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
536
539
),
537
540
},
538
541
{
539
542
Config : testKeycloakOpenidClient_pkceChallengeMethod (clientId , "" ),
540
543
Check : resource .ComposeTestCheckFunc (
541
544
testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "" ),
542
545
testAccCheckKeycloakOpenidClientHasExcludeSessionStateFromAuthResponse ("keycloak_openid_client.client" , false ),
546
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
543
547
),
544
548
},
545
549
},
@@ -587,6 +591,47 @@ func TestAccKeycloakOpenidClient_excludeSessionStateFromAuthResponse(t *testing.
587
591
})
588
592
}
589
593
594
+ func TestAccKeycloakOpenidClient_excludeIssuerFromAuthResponse (t * testing.T ) {
595
+ t .Parallel ()
596
+ clientId := acctest .RandomWithPrefix ("tf-acc" )
597
+
598
+ resource .Test (t , resource.TestCase {
599
+ ProviderFactories : testAccProviderFactories ,
600
+ PreCheck : func () { testAccPreCheck (t ) },
601
+ CheckDestroy : testAccCheckKeycloakOpenidClientDestroy (),
602
+ Steps : []resource.TestStep {
603
+ {
604
+ Config : testKeycloakOpenidClient_omitExcludeIssuerFromAuthResponse (clientId , "plain" ),
605
+ Check : resource .ComposeTestCheckFunc (
606
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
607
+ testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "plain" ),
608
+ ),
609
+ },
610
+ {
611
+ Config : testKeycloakOpenidClient_excludeIssuerFromAuthResponse (clientId , false ),
612
+ Check : resource .ComposeTestCheckFunc (
613
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
614
+ testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "" ),
615
+ ),
616
+ },
617
+ {
618
+ Config : testKeycloakOpenidClient_excludeIssuerFromAuthResponse (clientId , true ),
619
+ Check : resource .ComposeTestCheckFunc (
620
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , true ),
621
+ testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "" ),
622
+ ),
623
+ },
624
+ {
625
+ Config : testKeycloakOpenidClient_excludeIssuerFromAuthResponse (clientId , false ),
626
+ Check : resource .ComposeTestCheckFunc (
627
+ testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse ("keycloak_openid_client.client" , false ),
628
+ testAccCheckKeycloakOpenidClientHasPkceCodeChallengeMethod ("keycloak_openid_client.client" , "" ),
629
+ ),
630
+ },
631
+ },
632
+ })
633
+ }
634
+
590
635
func TestAccKeycloakOpenidClient_authenticationFlowBindingOverrides (t * testing.T ) {
591
636
t .Parallel ()
592
637
clientId := acctest .RandomWithPrefix ("tf-acc" )
@@ -1086,6 +1131,21 @@ func testAccCheckKeycloakOpenidClientHasExcludeSessionStateFromAuthResponse(reso
1086
1131
}
1087
1132
}
1088
1133
1134
+ func testAccCheckKeycloakOpenidClientHasExcludeIssuerFromAuthResponse (resourceName string , excludeIssuerFromAuthResponse types.KeycloakBoolQuoted ) resource.TestCheckFunc {
1135
+ return func (s * terraform.State ) error {
1136
+ client , err := getOpenidClientFromState (s , resourceName )
1137
+ if err != nil {
1138
+ return err
1139
+ }
1140
+
1141
+ if client .Attributes .ExcludeIssuerFromAuthResponse != excludeIssuerFromAuthResponse {
1142
+ return fmt .Errorf ("expected openid client %s to have exclude_issuer_from_auth_response value of %t, but got %t" , client .ClientId , excludeIssuerFromAuthResponse , client .Attributes .ExcludeIssuerFromAuthResponse )
1143
+ }
1144
+
1145
+ return nil
1146
+ }
1147
+ }
1148
+
1089
1149
func testAccCheckKeycloakOpenidClientAuthenticationFlowBindingOverrides (resourceName , flowResourceName string ) resource.TestCheckFunc {
1090
1150
return func (s * terraform.State ) error {
1091
1151
client , err := getOpenidClientFromState (s , resourceName )
@@ -1381,6 +1441,22 @@ resource "keycloak_openid_client" "client" {
1381
1441
` , testAccRealm .Realm , clientId , excludeSessionStateFromAuthResponse )
1382
1442
}
1383
1443
1444
+ func testKeycloakOpenidClient_excludeIssuerFromAuthResponse (clientId string , excludeIssuerFromAuthResponse bool ) string {
1445
+
1446
+ return fmt .Sprintf (`
1447
+ data "keycloak_realm" "realm" {
1448
+ realm = "%s"
1449
+ }
1450
+
1451
+ resource "keycloak_openid_client" "client" {
1452
+ client_id = "%s"
1453
+ realm_id = data.keycloak_realm.realm.id
1454
+ access_type = "CONFIDENTIAL"
1455
+ exclude_issuer_from_auth_response = %t
1456
+ }
1457
+ ` , testAccRealm .Realm , clientId , excludeIssuerFromAuthResponse )
1458
+ }
1459
+
1384
1460
func testKeycloakOpenidClient_omitPkceChallengeMethod (clientId string ) string {
1385
1461
1386
1462
return fmt .Sprintf (`
@@ -1412,6 +1488,22 @@ resource "keycloak_openid_client" "client" {
1412
1488
` , testAccRealm .Realm , clientId , pkceChallengeMethod )
1413
1489
}
1414
1490
1491
+ func testKeycloakOpenidClient_omitExcludeIssuerFromAuthResponse (clientId , pkceChallengeMethod string ) string {
1492
+
1493
+ return fmt .Sprintf (`
1494
+ data "keycloak_realm" "realm" {
1495
+ realm = "%s"
1496
+ }
1497
+
1498
+ resource "keycloak_openid_client" "client" {
1499
+ client_id = "%s"
1500
+ realm_id = data.keycloak_realm.realm.id
1501
+ access_type = "CONFIDENTIAL"
1502
+ pkce_code_challenge_method = "%s"
1503
+ }
1504
+ ` , testAccRealm .Realm , clientId , pkceChallengeMethod )
1505
+ }
1506
+
1415
1507
func testKeycloakOpenidClient_updateRealmBefore (clientId string ) string {
1416
1508
return fmt .Sprintf (`
1417
1509
data "keycloak_realm" "realm_1" {
0 commit comments