Skip to content

Commit 66258f8

Browse files
authored
feat: Add support for DPop configuration - GA (#1487)
* feat: Add support for DPop configuration - GA * update recording * rollback
1 parent 087972e commit 66258f8

12 files changed

Lines changed: 978 additions & 1431 deletions

File tree

docs/data-sources/resource_server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Read-Only:
6969
- `disable` (Boolean)
7070
- `mechanism` (String)
7171
- `required` (Boolean)
72+
- `required_for` (String)
7273

7374

7475
<a id="nestedatt--scopes"></a>

docs/resources/resource_server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Optional:
124124
- `disable` (Boolean) Disable proof-of-possession.
125125
- `mechanism` (String) Mechanism used for proof-of-possession. `mtls` or `dpop` is supported.
126126
- `required` (Boolean) Indicates whether proof-of-possession is required with this resource server.
127+
- `required_for` (String) Specifies which client types require Proof-of-Possession`all_clients` or `public_clients` is supported.
127128

128129

129130
<a id="nestedblock--subject_type_authorization"></a>

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.24.7
66

77
require (
88
github.com/PuerkitoBio/rehttp v1.4.0
9-
github.com/auth0/go-auth0 v1.34.0
9+
github.com/auth0/go-auth0 v1.34.1-0.20260226082301-a3c87d2ee65d
1010
github.com/auth0/go-auth0/v2 v2.5.0
1111
github.com/google/go-cmp v0.7.0
1212
github.com/hashicorp/go-cty v1.5.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew
2626
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
2727
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
2828
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
29-
github.com/auth0/go-auth0 v1.34.0 h1:5rtel4yYbYp+NYlVf3ryxSRaDHWxJubtVc+cqdLMa7o=
30-
github.com/auth0/go-auth0 v1.34.0/go.mod h1:32sQB1uAn+99fJo6N819EniKq8h785p0ag0lMWhiTaE=
29+
github.com/auth0/go-auth0 v1.34.1-0.20260226082301-a3c87d2ee65d h1:XPqHZdVXvHVz4uujunGO4xWXWBexq4BM9WekQt4wrQ8=
30+
github.com/auth0/go-auth0 v1.34.1-0.20260226082301-a3c87d2ee65d/go.mod h1:32sQB1uAn+99fJo6N819EniKq8h785p0ag0lMWhiTaE=
3131
github.com/auth0/go-auth0/v2 v2.5.0 h1:IBfiYGsqFwOu4hsxV1JDtB6+ayRinybUIUCU/fRBE8Y=
3232
github.com/auth0/go-auth0/v2 v2.5.0/go.mod h1:XVRck9fw1EIw1z4guYcbKFGmElnexb+xOvQ/0U1hHd0=
3333
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48=

internal/auth0/resourceserver/expand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ func expandProofOfPossession(data *schema.ResourceData) *management.ResourceServ
294294
config.ForEachElement(func(_ cty.Value, cfg cty.Value) (stop bool) {
295295
proofOfPossession.Mechanism = value.String(cfg.GetAttr("mechanism"))
296296
proofOfPossession.Required = value.Bool(cfg.GetAttr("required"))
297+
proofOfPossession.RequiredFor = value.String(cfg.GetAttr("required_for"))
297298
return stop
298299
})
299300

internal/auth0/resourceserver/flatten.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ func flattenProofOfPossession(proofOfPossession *management.ResourceServerProofO
137137
}
138138
}
139139
result := map[string]interface{}{
140-
"mechanism": proofOfPossession.GetMechanism(),
141-
"required": proofOfPossession.GetRequired(),
140+
"mechanism": proofOfPossession.GetMechanism(),
141+
"required": proofOfPossession.GetRequired(),
142+
"required_for": proofOfPossession.GetRequiredFor(),
142143
}
143144

144145
return []map[string]interface{}{result}

internal/auth0/resourceserver/resource.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ func NewResource() *schema.Resource {
250250
Optional: true,
251251
Description: "Disable proof-of-possession.",
252252
},
253+
"required_for": {
254+
Type: schema.TypeString,
255+
Optional: true,
256+
ValidateFunc: validation.StringInSlice([]string{
257+
"all_clients", "public_clients",
258+
}, true),
259+
Description: "Specifies which client types require Proof-of-Possession" +
260+
"`all_clients` or `public_clients` is supported.",
261+
},
253262
},
254263
},
255264
},

internal/auth0/resourceserver/resource_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ EOF
122122
proof_of_possession {
123123
mechanism = "dpop"
124124
required = true
125+
required_for = "all_clients"
125126
}
126127
127128
}
@@ -352,6 +353,7 @@ func TestAccResourceServer(t *testing.T) {
352353
resource.TestCheckResourceAttr("auth0_resource_server.my_resource_server", "proof_of_possession.0.disable", "false"),
353354
resource.TestCheckResourceAttr("auth0_resource_server.my_resource_server", "proof_of_possession.0.mechanism", "dpop"),
354355
resource.TestCheckResourceAttr("auth0_resource_server.my_resource_server", "proof_of_possession.0.required", "true"),
356+
resource.TestCheckResourceAttr("auth0_resource_server.my_resource_server", "proof_of_possession.0.required_for", "all_clients"),
355357
),
356358
},
357359
{

test/data/recordings/TestAccResourceServer.yaml

Lines changed: 193 additions & 301 deletions
Large diffs are not rendered by default.

test/data/recordings/TestAccResourceServerIsSystem.yaml

Lines changed: 16 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interactions:
1919
Content-Type:
2020
- application/json
2121
User-Agent:
22-
- Go-Auth0/1.31.0
22+
- Go-Auth0/1.34.0
2323
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers
2424
method: POST
2525
response:
@@ -30,158 +30,14 @@ interactions:
3030
trailer: {}
3131
content_length: 486
3232
uncompressed: false
33-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
33+
body: '{"id":"69a006b2b917ad2948e1a2ad","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
3434
headers:
3535
Content-Type:
3636
- application/json; charset=utf-8
3737
status: 201 Created
3838
code: 201
39-
duration: 621.437417ms
39+
duration: 308.8345ms
4040
- id: 1
41-
request:
42-
proto: HTTP/1.1
43-
proto_major: 1
44-
proto_minor: 1
45-
content_length: 24
46-
transfer_encoding: []
47-
trailer: {}
48-
host: terraform-provider-auth0-dev.eu.auth0.com
49-
remote_addr: ""
50-
request_uri: ""
51-
body: |
52-
{"consent_policy":null}
53-
form: {}
54-
headers:
55-
Content-Type:
56-
- application/json
57-
User-Agent:
58-
- Go-Auth0/1.31.0
59-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
60-
method: PATCH
61-
response:
62-
proto: HTTP/2.0
63-
proto_major: 2
64-
proto_minor: 0
65-
transfer_encoding: []
66-
trailer: {}
67-
content_length: -1
68-
uncompressed: true
69-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
70-
headers:
71-
Content-Type:
72-
- application/json; charset=utf-8
73-
status: 200 OK
74-
code: 200
75-
duration: 434.232334ms
76-
- id: 2
77-
request:
78-
proto: HTTP/1.1
79-
proto_major: 1
80-
proto_minor: 1
81-
content_length: 31
82-
transfer_encoding: []
83-
trailer: {}
84-
host: terraform-provider-auth0-dev.eu.auth0.com
85-
remote_addr: ""
86-
request_uri: ""
87-
body: |
88-
{"authorization_details":null}
89-
form: {}
90-
headers:
91-
Content-Type:
92-
- application/json
93-
User-Agent:
94-
- Go-Auth0/1.31.0
95-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
96-
method: PATCH
97-
response:
98-
proto: HTTP/2.0
99-
proto_major: 2
100-
proto_minor: 0
101-
transfer_encoding: []
102-
trailer: {}
103-
content_length: -1
104-
uncompressed: true
105-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
106-
headers:
107-
Content-Type:
108-
- application/json; charset=utf-8
109-
status: 200 OK
110-
code: 200
111-
duration: 499.012375ms
112-
- id: 3
113-
request:
114-
proto: HTTP/1.1
115-
proto_major: 1
116-
proto_minor: 1
117-
content_length: 26
118-
transfer_encoding: []
119-
trailer: {}
120-
host: terraform-provider-auth0-dev.eu.auth0.com
121-
remote_addr: ""
122-
request_uri: ""
123-
body: |
124-
{"token_encryption":null}
125-
form: {}
126-
headers:
127-
Content-Type:
128-
- application/json
129-
User-Agent:
130-
- Go-Auth0/1.31.0
131-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
132-
method: PATCH
133-
response:
134-
proto: HTTP/2.0
135-
proto_major: 2
136-
proto_minor: 0
137-
transfer_encoding: []
138-
trailer: {}
139-
content_length: -1
140-
uncompressed: true
141-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
142-
headers:
143-
Content-Type:
144-
- application/json; charset=utf-8
145-
status: 200 OK
146-
code: 200
147-
duration: 596.468084ms
148-
- id: 4
149-
request:
150-
proto: HTTP/1.1
151-
proto_major: 1
152-
proto_minor: 1
153-
content_length: 29
154-
transfer_encoding: []
155-
trailer: {}
156-
host: terraform-provider-auth0-dev.eu.auth0.com
157-
remote_addr: ""
158-
request_uri: ""
159-
body: |
160-
{"proof_of_possession":null}
161-
form: {}
162-
headers:
163-
Content-Type:
164-
- application/json
165-
User-Agent:
166-
- Go-Auth0/1.31.0
167-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
168-
method: PATCH
169-
response:
170-
proto: HTTP/2.0
171-
proto_major: 2
172-
proto_minor: 0
173-
transfer_encoding: []
174-
trailer: {}
175-
content_length: -1
176-
uncompressed: true
177-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
178-
headers:
179-
Content-Type:
180-
- application/json; charset=utf-8
181-
status: 200 OK
182-
code: 200
183-
duration: 493.834875ms
184-
- id: 5
18541
request:
18642
proto: HTTP/1.1
18743
proto_major: 1
@@ -196,8 +52,8 @@ interactions:
19652
form: {}
19753
headers:
19854
User-Agent:
199-
- Go-Auth0/1.31.0
200-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
55+
- Go-Auth0/1.34.0
56+
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/69a006b2b917ad2948e1a2ad
20157
method: GET
20258
response:
20359
proto: HTTP/2.0
@@ -207,14 +63,14 @@ interactions:
20763
trailer: {}
20864
content_length: -1
20965
uncompressed: true
210-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
66+
body: '{"id":"69a006b2b917ad2948e1a2ad","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
21167
headers:
21268
Content-Type:
21369
- application/json; charset=utf-8
21470
status: 200 OK
21571
code: 200
216-
duration: 427.665541ms
217-
- id: 6
72+
duration: 378.755375ms
73+
- id: 2
21874
request:
21975
proto: HTTP/1.1
22076
proto_major: 1
@@ -229,8 +85,8 @@ interactions:
22985
form: {}
23086
headers:
23187
User-Agent:
232-
- Go-Auth0/1.31.0
233-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
88+
- Go-Auth0/1.34.0
89+
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/69a006b2b917ad2948e1a2ad
23490
method: GET
23591
response:
23692
proto: HTTP/2.0
@@ -240,14 +96,14 @@ interactions:
24096
trailer: {}
24197
content_length: -1
24298
uncompressed: true
243-
body: '{"id":"691ca11775c27084b9f94f2d","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
99+
body: '{"id":"69a006b2b917ad2948e1a2ad","name":"Acceptance Test - IsSystem - TestAccResourceServerIsSystem","identifier":"https://uat.api.terraform-provider-auth0.com/issystem/TestAccResourceServerIsSystem","allow_offline_access":true,"skip_consent_for_verifiable_first_party_clients":true,"subject_type_authorization":{"user":{"policy":"allow_all"},"client":{"policy":"require_client_grant"}},"token_lifetime":7200,"token_lifetime_for_web":3600,"signing_alg":"RS256","enforce_policies":false}'
244100
headers:
245101
Content-Type:
246102
- application/json; charset=utf-8
247103
status: 200 OK
248104
code: 200
249-
duration: 602.582416ms
250-
- id: 7
105+
duration: 305.127ms
106+
- id: 3
251107
request:
252108
proto: HTTP/1.1
253109
proto_major: 1
@@ -262,8 +118,8 @@ interactions:
262118
form: {}
263119
headers:
264120
User-Agent:
265-
- Go-Auth0/1.31.0
266-
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/691ca11775c27084b9f94f2d
121+
- Go-Auth0/1.34.0
122+
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/resource-servers/69a006b2b917ad2948e1a2ad
267123
method: DELETE
268124
response:
269125
proto: HTTP/2.0
@@ -279,4 +135,4 @@ interactions:
279135
- application/json; charset=utf-8
280136
status: 204 No Content
281137
code: 204
282-
duration: 491.48525ms
138+
duration: 309.718916ms

0 commit comments

Comments
 (0)