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

Commit 29f3e2f

Browse files
author
Alex Kalyvitis
committed
Merge branch 'yvovandoorn-yvovandoorn/addSAMLmappings/1' into master
2 parents e46c269 + b3da1f4 commit 29f3e2f

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

auth0/resource_auth0_connection.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ var connectionSchema = map[string]*schema.Schema{
435435
Optional: true,
436436
Description: "",
437437
},
438+
// SAML options
438439
"debug": {
439440
Type: schema.TypeBool,
440441
Optional: true,
@@ -454,6 +455,16 @@ var connectionSchema = map[string]*schema.Schema{
454455
"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
455456
}, true),
456457
},
458+
"request_template": {
459+
Type: schema.TypeString,
460+
Optional: true,
461+
Description: "Template that formats the SAML request.",
462+
},
463+
"user_id_attribute": {
464+
Type: schema.TypeString,
465+
Optional: true,
466+
Description: "Attribute in the SAML token that will be mapped to the user_id property in Auth0.",
467+
},
457468
"idp_initiated": {
458469
Type: schema.TypeList,
459470
MaxItems: 1,

auth0/resource_auth0_connection_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,11 +1139,14 @@ yE+vPxsiUkvQHdO2fojCkY8jg70jxM+gu59tPDNbw3Uh/2Ij310FgTHsnGQMyA==
11391139
EOF
11401140
sign_in_endpoint = "https://saml.provider/sign_in"
11411141
sign_out_endpoint = "https://saml.provider/sign_out"
1142+
user_id_attribute = "https://saml.provider/imi/ns/identity-200810"
11421143
tenant_domain = "example.com"
11431144
domain_aliases = ["example.com", "example.coz"]
11441145
protocol_binding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Post"
1146+
request_template = "<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"\n@@AssertServiceURLAndDestination@@\n ID=\"@@ID@@\"\n IssueInstant=\"@@IssueInstant@@\"\n ProtocolBinding=\"@@ProtocolBinding@@\" Version=\"2.0\">\n <saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">@@Issuer@@</saml:Issuer>\n</samlp:AuthnRequest>"
11451147
signature_algorithm = "rsa-sha256"
11461148
digest_algorithm = "sha256"
1149+
icon_url = "https://example.com/logo.svg"
11471150
fields_map = {
11481151
foo = "bar"
11491152
baz = "baa"

auth0/structure_auth0_connection.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ func flattenConnectionOptionsSAML(o *management.ConnectionOptionsSAML) interface
233233
"digest_algorithm": o.GetDigestAglorithm(),
234234
"fields_map": o.FieldsMap,
235235
"sign_saml_request": o.GetSignSAMLRequest(),
236+
"icon_url": o.GetLogoURL(),
237+
"request_template": o.GetRequestTemplate(),
238+
"user_id_attribute": o.GetUserIDAttribute(),
236239
}
237240
}
238241

@@ -552,6 +555,9 @@ func expandConnectionOptionsSAML(d ResourceData) *management.ConnectionOptionsSA
552555
DigestAglorithm: String(d, "digest_algorithm"),
553556
FieldsMap: Map(d, "fields_map"),
554557
SignSAMLRequest: Bool(d, "sign_saml_request"),
558+
RequestTemplate: String(d, "request_template"),
559+
UserIDAttribute: String(d, "user_id_attribute"),
560+
LogoURL: String(d, "icon_url"),
555561
}
556562

557563
List(d, "idp_initiated").Elem(func(d ResourceData) {

docs/resources/connection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ With the `samlp` connection strategy, `options` supports the following arguments
374374
* `sign_saml_request` - (Optional) (Boolean) When enabled, the SAML authentication request will be signed.
375375
* `signature_algorithm` - (Optional) Sign Request Algorithm
376376
* `digest_algorithm` - (Optional) Sign Request Algorithm Digest
377+
* `request_template` - (Optional) Template that formats the SAML request
378+
* `user_id_attribute` - (Optional) Attribute in the SAML token that will be mapped to the user_id property in Auth0.
377379

378380
**Example**:
379381
```hcl
@@ -387,6 +389,8 @@ resource "auth0_connection" "samlp" {
387389
tenant_domain = "example.com"
388390
domain_aliases = ["example.com", "alias.example.com"]
389391
binding_method = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Post"
392+
request_template = "<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"\n@@AssertServiceURLAndDestination@@\n ID=\"@@ID@@\"\n IssueInstant=\"@@IssueInstant@@\"\n ProtocolBinding=\"@@ProtocolBinding@@\" Version=\"2.0\">\n <saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">@@Issuer@@</saml:Issuer>\n</samlp:AuthnRequest>"
393+
user_id_attribute = "https://saml.provider/imi/ns/identity-200810"
390394
signature_algorithm = "rsa-sha256"
391395
digest_algorithm = "sha256"
392396
fields_map = {

0 commit comments

Comments
 (0)