Skip to content

Commit

Permalink
feat(saml_connection): add field
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasLopes7 committed Sep 26, 2024
1 parent 1f2556d commit 741670a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions saml_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type SAMLConnection struct {
Name string `json:"name"`
Domain string `json:"domain"`
IdpEntityID *string `json:"idp_entity_id"`
OrganizationID *string `json:"organization_id"`
IdpSsoURL *string `json:"idp_sso_url"`
IdpCertificate *string `json:"idp_certificate"`
IdpMetadataURL *string `json:"idp_metadata_url"`
Expand Down
12 changes: 9 additions & 3 deletions samlconnection/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type AttributeMappingParams struct {
type CreateParams struct {
clerk.APIParams
Name *string `json:"name,omitempty"`
OrganizationID *string `json:"organization_id,omitempty"`
Domain *string `json:"domain,omitempty"`
Provider *string `json:"provider,omitempty"`
IdpEntityID *string `json:"idp_entity_id,omitempty"`
Expand Down Expand Up @@ -67,9 +68,14 @@ func (c *Client) Get(ctx context.Context, id string) (*clerk.SAMLConnection, err

type UpdateParams struct {
clerk.APIParams
Name *string `json:"name,omitempty"`
Domain *string `json:"domain,omitempty"`
IdpEntityID *string `json:"idp_entity_id,omitempty"`
Name *string `json:"name,omitempty"`
Domain *string `json:"domain,omitempty"`
IdpEntityID *string `json:"idp_entity_id,omitempty"`
// OrganizationID is a nullable optional field.
// - If nil or unset, the backend will not take any action.
// - If an empty value (""), the backend will unset the organization_id.
// - If a valid ID is provided, the backend will update the organization_id.
OrganizationID *string `json:"organization_id,omitempty"`
IdpSsoURL *string `json:"idp_sso_url,omitempty"`
IdpCertificate *string `json:"idp_certificate,omitempty"`
IdpMetadataURL *string `json:"idp_metadata_url,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion samlconnection/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestSAMLConnectionClientUpdate(t *testing.T) {
config.HTTPClient = &http.Client{
Transport: &clerktest.RoundTripper{
T: t,
In: json.RawMessage(fmt.Sprintf(`{"name":"%s", "disable_additional_identifications": %t}`, name, disableAdditionalIdentifications)),
In: json.RawMessage(fmt.Sprintf(`{"name":"%s", "disable_additional_identifications": %t, "organization_id": ""}`, name, disableAdditionalIdentifications)),
Out: json.RawMessage(fmt.Sprintf(`{"id":"%s","name":"%s","domain":"%s","provider":"%s","disable_additional_identifications": %t}`, id, name, domain, provider, disableAdditionalIdentifications)),
Method: http.MethodPatch,
Path: "/v1/saml_connections/" + id,
Expand All @@ -113,6 +113,7 @@ func TestSAMLConnectionClientUpdate(t *testing.T) {
samlConnection, err := client.Update(context.Background(), id, &UpdateParams{
Name: clerk.String(name),
DisableAdditionalIdentifications: clerk.Bool(disableAdditionalIdentifications),
OrganizationID: clerk.String(""),
})
require.NoError(t, err)
require.Equal(t, id, samlConnection.ID)
Expand Down

0 comments on commit 741670a

Please sign in to comment.