From 6456be618d1885ab79e843e5846573f30a1dd89a Mon Sep 17 00:00:00 2001 From: "A. Craig West" Date: Tue, 17 Sep 2024 13:32:51 -0400 Subject: [PATCH] Add tests for strategy_version --- management/connection_test.go | 79 ++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/management/connection_test.go b/management/connection_test.go index e4875fc3..0a063071 100644 --- a/management/connection_test.go +++ b/management/connection_test.go @@ -21,7 +21,8 @@ var connectionTestCases = []connectionTestCase{ Strategy: auth0.String("auth0"), }, options: &ConnectionOptions{ - UpstreamParams: map[string]interface{}{ + StrategyVersion: auth0.Int(2), + UpstreamParams: map[string]interface{}{ "screen_name": map[string]interface{}{ "alias": "login_hint", }, @@ -35,7 +36,8 @@ var connectionTestCases = []connectionTestCase{ Strategy: auth0.String("wordpress"), }, options: &ConnectionOptionsOAuth2{ - Scope: auth0.String("email profile openid"), + StrategyVersion: auth0.Int(2), + Scope: auth0.String("email profile openid"), UpstreamParams: map[string]interface{}{ "screen_name": map[string]interface{}{ "alias": "login_hint", @@ -185,8 +187,9 @@ var connectionTestCases = []connectionTestCase{ Strategy: auth0.String("samlp"), }, options: &ConnectionOptionsSAML{ - SignInEndpoint: auth0.String("https://saml.identity/provider"), - SigningCert: auth0.String(`-----BEGIN CERTIFICATE----- + StrategyVersion: auth0.Int(2), + SignInEndpoint: auth0.String("https://saml.identity/provider"), + SigningCert: auth0.String(`-----BEGIN CERTIFICATE----- MIID6TCCA1ICAQEwDQYJKoZIhvcNAQEFBQAwgYsxCzAJBgNVBAYTAlVTMRMwEQYD VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRQwEgYDVQQK EwtHb29nbGUgSW5jLjEMMAoGA1UECxMDRW5nMQwwCgYDVQQDEwNhZ2wxHTAbBgkq @@ -226,6 +229,25 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g }, }, }, + { + name: "Azure-AD Connection", + connection: Connection{ + Name: auth0.Stringf("Test-AzureAD-Connection-%d", time.Now().Unix()), + Strategy: auth0.String("waad"), + }, + options: &ConnectionOptionsAzureAD{ + StrategyVersion: auth0.Int(2), + Domain: auth0.String("example.onmicrosoft.com"), + TenantDomain: auth0.String("example.onmicrosoft.com"), + ClientID: auth0.String("123456"), + ClientSecret: auth0.String("123456"), + UpstreamParams: map[string]interface{}{ + "screen_name": map[string]interface{}{ + "alias": "login_hint", + }, + }, + }, + }, { name: "AD Connection", connection: Connection{ @@ -233,6 +255,7 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g Strategy: auth0.String("ad"), }, options: &ConnectionOptionsAD{ + StrategyVersion: auth0.Int(2), UpstreamParams: map[string]interface{}{ "screen_name": map[string]interface{}{ "alias": "login_hint", @@ -247,7 +270,8 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g Strategy: auth0.String("adfs"), }, options: &ConnectionOptionsADFS{ - FedMetadataXML: auth0.String(` + StrategyVersion: auth0.Int(2), + FedMetadataXML: auth0.String(`