Skip to content

Commit 8011ff4

Browse files
authored
SSO: Add entity_id to SAML provider settings (#1902)
1 parent 1d29496 commit 8011ff4

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/resources/sso_settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Optional:
265265
- `client_id` (String) The client Id of your OAuth2 app.
266266
- `client_secret` (String) The client secret of your OAuth2 app.
267267
- `enabled` (Boolean) Define whether this configuration is enabled for SAML. Defaults to `true`.
268+
- `entity_id` (String) The entity ID is a globally unique identifier for the service provider. It is used to identify the service provider to the identity provider. Defaults to the URL of the Grafana instance if not set.
268269
- `force_use_graph_api` (Boolean) If enabled, Grafana will fetch groups from Microsoft Graph API instead of using the groups claim from the ID token.
269270
- `idp_metadata` (String) Base64-encoded string for the IdP SAML metadata XML.
270271
- `idp_metadata_path` (String) Path for the IdP SAML metadata XML.

internal/resources/grafana/resource_sso_settings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ var samlSettingsSchema = &schema.Resource{
309309
Optional: true,
310310
Description: "Name used to refer to the SAML authentication.",
311311
},
312+
"entity_id": {
313+
Type: schema.TypeString,
314+
Optional: true,
315+
Description: "The entity ID is a globally unique identifier for the service provider. It is used to identify the service provider to the identity provider. Defaults to the URL of the Grafana instance if not set.",
316+
},
312317
"single_logout": {
313318
Type: schema.TypeBool,
314319
Optional: true,

internal/resources/grafana/resource_sso_settings_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func TestSSOSettings_basic_saml(t *testing.T) {
9191
resource.TestCheckResourceAttr(resourceName, "saml_settings.0.idp_metadata_url", "https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml"),
9292
resource.TestCheckResourceAttr(resourceName, "saml_settings.0.signature_algorithm", "rsa-sha256"),
9393
resource.TestCheckResourceAttr(resourceName, "saml_settings.0.metadata_valid_duration", "24h"),
94+
resource.TestCheckResourceAttr(resourceName, "saml_settings.0.entity_id", "https://custom-entity-id.com"),
9495
),
9596
},
9697
{
@@ -446,6 +447,7 @@ const testConfigForSamlProvider = `resource "grafana_sso_settings" "saml_sso_set
446447
idp_metadata_url = "https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml"
447448
signature_algorithm = "rsa-sha256"
448449
metadata_valid_duration = "24h"
450+
entity_id = "https://custom-entity-id.com"
449451
}
450452
}`
451453

0 commit comments

Comments
 (0)