Skip to content

Commit 0bb1ed9

Browse files
authored
step 1 (#37)
1 parent 85efa2d commit 0bb1ed9

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

tf/02-donor-website.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ resource "auth0_connection_clients" "UPA-clients" {
8484
var.auth0_tf_client_id,
8585
data.auth0_client.default-app.client_id,
8686
auth0_client.donor-cli.client_id,
87+
auth0_client.hono-rwa.client_id
8788
]
8889
}
8990

tf/04-business-website.tf

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,59 +70,59 @@ EOT
7070
resource "auth0_resource_server" "business_api" {
7171
name = "Business API"
7272
identifier = "business.api"
73-
73+
7474
# Token settings
75-
token_lifetime = 86400 # 24 hours
75+
token_lifetime = 86400 # 24 hours
7676
skip_consent_for_verifiable_first_party_clients = true
77-
77+
7878
# JWT settings
7979
signing_alg = "RS256"
80-
80+
8181
allow_offline_access = false
8282

8383
enforce_policies = true
84-
token_dialect = "access_token_authz"
84+
token_dialect = "access_token_authz"
8585
}
8686

8787
# Define scopes for business API
88-
resource "auth0_resource_server_scopes" business-api-scopes {
88+
resource "auth0_resource_server_scopes" "business-api-scopes" {
8989
resource_server_identifier = auth0_resource_server.business_api.identifier
9090

9191
// -- pickups --
9292
scopes {
93-
name = "read:pickups"
93+
name = "read:pickups"
9494
description = "read:pickups"
9595
}
9696

9797
scopes {
98-
name = "create:pickups"
98+
name = "create:pickups"
9999
description = "create:pickups"
100100
}
101101

102102
scopes {
103-
name = "update:pickups"
103+
name = "update:pickups"
104104
description = "update:pickups"
105105
}
106106

107107
// -- schedules --
108108
scopes {
109-
name = "read:schedules"
109+
name = "read:schedules"
110110
description = "read:schedules"
111111
}
112112

113113
scopes {
114-
name = "update:schedules"
114+
name = "update:schedules"
115115
description = "update:schedules"
116116
}
117117

118118
// -- organization --
119119
scopes {
120-
name = "read:organization"
120+
name = "read:organization"
121121
description = "read:organization"
122122
}
123123

124124
scopes {
125-
name = "update:organization"
125+
name = "update:organization"
126126
description = "update:organization"
127127
}
128128
}
@@ -132,8 +132,9 @@ data "auth0_resource_server" "my-org" {
132132
}
133133

134134
resource "auth0_client_grant" "business-my-org-grant" {
135-
audience = data.auth0_resource_server.my-org.identifier
136-
client_id = auth0_client.business.client_id
135+
audience = data.auth0_resource_server.my-org.identifier
136+
client_id = auth0_client.business.client_id
137+
organization_usage = "require"
137138
scopes = [
138139
"read:my_org:details",
139140
"update:my_org:details",
@@ -650,8 +651,8 @@ resource "auth0_connection_clients" "business-db-clients" {
650651

651652
# Creates a Cloudflare D1 database for CRM data. A future worker/API will connect to this DB.
652653
resource "cloudflare_d1_database" "business" {
653-
account_id = var.cloudflare_account_id
654-
name = "replate-business"
654+
account_id = var.cloudflare_account_id
655+
name = "replate-business"
655656
primary_location_hint = "apac"
656657
read_replication = {
657658
mode = "disabled"
@@ -682,4 +683,4 @@ EOT
682683

683684
output "business-client_id" {
684685
value = auth0_client.business.client_id
685-
}
686+
}

tf/13-rwa-client.tf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Temporary, not part of demo
2+
resource "auth0_client" "hono-rwa" {
3+
name = "Hono RWA"
4+
description = "Hono RWA for SDK Gallery"
5+
app_type = "regular_web"
6+
7+
callbacks = [
8+
"https://hono-rwa-myaccount.abbaspour.workers.dev/auth/callback"
9+
]
10+
11+
allowed_logout_urls = [
12+
"https://hono-rwa-myaccount.abbaspour.workers.dev/logout"
13+
]
14+
15+
grant_types = [
16+
"authorization_code",
17+
"refresh_token"
18+
]
19+
}
20+
21+
output "hono-client-id" {
22+
value = auth0_client.hono-rwa.client_id
23+
}
24+
25+
resource "auth0_client_grant" "hono-myaccount-grant" {
26+
audience = data.auth0_resource_server.my-account.identifier
27+
client_id = auth0_client.hono-rwa.client_id
28+
scopes = [
29+
// authentication methods
30+
"read:me:authentication_methods",
31+
"delete:me:authentication_methods",
32+
"update:me:authentication_methods",
33+
"create:me:authentication_methods",
34+
// factors
35+
"read:me:factors",
36+
// connected_accounts
37+
"create:me:connected_accounts",
38+
"read:me:connected_accounts",
39+
"delete:me:connected_accounts"
40+
]
41+
subject_type = "user"
42+
}

0 commit comments

Comments
 (0)