Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 12e4017

Browse files
authored
Merge pull request #467 from alexkappa/fix-connection-strategy-adfs
Flatten/expand ADFS
2 parents 0fe4bc3 + 6b69061 commit 12e4017

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

auth0/structure_auth0_connection.go

+28
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ func flattenConnectionOptions(d ResourceData, options interface{}) []interface{}
4040
m = flattenConnectionOptionsAD(o)
4141
case *management.ConnectionOptionsAzureAD:
4242
m = flattenConnectionOptionsAzureAD(o)
43+
case *management.ConnectionOptionsADFS:
44+
m = flattenConnectionOptionsADFS(o)
4345
case *management.ConnectionOptionsSAML:
4446
m = flattenConnectionOptionsSAML(o)
4547
}
@@ -250,6 +252,18 @@ func flattenConnectionOptionsAzureAD(o *management.ConnectionOptionsAzureAD) int
250252
}
251253
}
252254

255+
func flattenConnectionOptionsADFS(o *management.ConnectionOptionsADFS) interface{} {
256+
return map[string]interface{}{
257+
"tenant_domain": o.GetTenantDomain(),
258+
"domain_aliases": o.DomainAliases,
259+
"icon_url": o.GetLogoURL(),
260+
"adfs_server": o.GetADFSServer(),
261+
"api_enable_users": o.GetEnableUsersAPI(),
262+
"set_user_root_attributes": o.GetSetUserAttributes(),
263+
"non_persistent_attrs": o.GetNonPersistentAttrs(),
264+
}
265+
}
266+
253267
func flattenConnectionOptionsSAML(o *management.ConnectionOptionsSAML) interface{} {
254268
return map[string]interface{}{
255269
"signing_cert": o.GetSigningCert(),
@@ -323,6 +337,8 @@ func expandConnection(d ResourceData) *management.Connection {
323337
c.Options = expandConnectionOptionsEmail(d)
324338
case management.ConnectionStrategySAML:
325339
c.Options = expandConnectionOptionsSAML(d)
340+
case management.ConnectionStrategyADFS:
341+
c.Options = expandConnectionOptionsADFS(d)
326342
default:
327343
log.Printf("[WARN]: Unsupported connection strategy %s", s)
328344
log.Printf("[WARN]: Raise an issue with the auth0 provider in order to support it:")
@@ -666,6 +682,18 @@ func expandConnectionOptionsSAML(d ResourceData) *management.ConnectionOptionsSA
666682
return o
667683
}
668684

685+
func expandConnectionOptionsADFS(d ResourceData) *management.ConnectionOptionsADFS {
686+
return &management.ConnectionOptionsADFS{
687+
TenantDomain: String(d, "tenant_domain"),
688+
DomainAliases: Slice(d, "domain_aliases"),
689+
LogoURL: String(d, "icon_url"),
690+
ADFSServer: String(d, "adfs_server"),
691+
EnableUsersAPI: Bool(d, "api_enable_users"),
692+
SetUserAttributes: String(d, "set_user_root_attributes"),
693+
NonPersistentAttrs: castToListOfStrings(Set(d, "non_persistent_attrs").List()),
694+
}
695+
}
696+
669697
type scoper interface {
670698
Scopes() []string
671699
SetScopes(enable bool, scopes ...string)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ go 1.16
55
require (
66
github.com/hashicorp/go-multierror v1.1.1
77
github.com/hashicorp/terraform-plugin-sdk v1.16.1
8-
gopkg.in/auth0.v5 v5.21.0
8+
gopkg.in/auth0.v5 v5.21.1
99
)

0 commit comments

Comments
 (0)