Skip to content

Commit

Permalink
Merge pull request #2050 from aemard/bugfix-name-format-okta-idp-saml
Browse files Browse the repository at this point in the history
bugfix name format resource_okta_idp_saml.go
  • Loading branch information
duytiennguyen-okta committed Aug 12, 2024
2 parents bae5ae0 + 9a08167 commit 7a1c090
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/resources/okta_idp_saml/basic_updated.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ resource "okta_idp_saml" "test" {
response_signature_scope = "RESPONSE"
request_signature_scope = "REQUEST"
max_clock_skew = 60
name_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
}
4 changes: 4 additions & 0 deletions okta/resource_okta_idp_saml.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func resourceIdpSamlRead(ctx context.Context, d *schema.ResourceData, m interfac
_ = d.Set("issuer", idp.Protocol.Credentials.Trust.Issuer)
_ = d.Set("audience", idp.Protocol.Credentials.Trust.Audience)
_ = d.Set("kid", idp.Protocol.Credentials.Trust.Kid)
_ = d.Set("name_format", idp.Protocol.Settings.NameFormat)
syncIdpSamlAlgo(d, idp.Protocol.Algorithms)
err = syncGroupActions(d, idp.Policy.Provisioning.Groups)
if err != nil {
Expand Down Expand Up @@ -263,6 +264,9 @@ func buildIdPSaml(d *schema.ResourceData) (sdk.IdentityProvider, error) {
Audience: d.Get("audience").(string),
},
},
Settings: &sdk.ProtocolSettings{
NameFormat: d.Get("name_format").(string),
},
},
}
if d.Get("status") != nil {
Expand Down
3 changes: 3 additions & 0 deletions okta/resource_okta_idp_saml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccResourceOktaIdpSaml_crud(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "response_signature_algorithm", "SHA-256"),
resource.TestCheckResourceAttr(resourceName, "request_signature_scope", "REQUEST"),
resource.TestCheckResourceAttr(resourceName, "response_signature_scope", "ANY"),
resource.TestCheckResourceAttr(resourceName, "name_format", "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"),
resource.TestCheckResourceAttrSet(resourceName, "kid"),
),
},
Expand All @@ -56,6 +57,7 @@ func TestAccResourceOktaIdpSaml_crud(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "response_signature_algorithm", "SHA-256"),
resource.TestCheckResourceAttr(resourceName, "request_signature_scope", "REQUEST"),
resource.TestCheckResourceAttr(resourceName, "response_signature_scope", "RESPONSE"),
resource.TestCheckResourceAttr(resourceName, "name_format", "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"),
resource.TestCheckResourceAttrSet(resourceName, "kid"),
),
},
Expand All @@ -80,6 +82,7 @@ func TestAccResourceOktaIdpSaml_crud(t *testing.T) {
"kid",
"max_clock_skew",
"name",
"name_format",
"profile_master",
"provisioning_action",
"sso_binding",
Expand Down

0 comments on commit 7a1c090

Please sign in to comment.