Skip to content

Commit 4941eca

Browse files
authored
Merge branch 'main' into docs/improve-examples
2 parents 72bc68d + b5008a5 commit 4941eca

File tree

11 files changed

+522
-0
lines changed

11 files changed

+522
-0
lines changed

docs/resources/json_web_key_set.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ JSON Web Keys are used for signing and encrypting tokens. This resource generate
2323
| `HS256` | HMAC | Symmetric — uses shared secret, not suitable for public verification |
2424
| `HS512` | HMAC | Symmetric — stronger HMAC variant |
2525

26+
## Choosing the Right Algorithm
27+
28+
| Scenario | Recommended | Why |
29+
|----------|-------------|-----|
30+
| **General signing** (default) | `RS256` | Widest compatibility across OAuth2/OIDC libraries |
31+
| **High-performance signing** | `ES256` | Smaller keys, faster operations — ideal for high-throughput APIs |
32+
| **Maximum security** | `ES512` | Strongest elliptic curve option |
33+
| **Internal services only** | `HS256`/`HS512` | Symmetric — both parties must share the secret. Not suitable for public token verification |
34+
35+
### `sig` vs `enc` Use
36+
37+
| Use | Description |
38+
|-----|-------------|
39+
| `sig` | **Signing** — for JWT signing, ID token signing, and token verification. This is the most common use case. |
40+
| `enc` | **Encryption** — for encrypting tokens or data at rest. Rarely needed unless you have specific encryption requirements. |
41+
42+
Most configurations only need `use = "sig"`.
43+
2644
## Example Usage
2745

2846
```terraform

docs/resources/oauth2_client.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ resource "ory_oauth2_client" "web_app" {
8282
})
8383
}
8484
85+
# Client with custom token lifespans
86+
resource "ory_oauth2_client" "api_gateway" {
87+
client_name = "API Gateway"
88+
grant_types = ["client_credentials"]
89+
scope = "api:read api:write"
90+
91+
# Short-lived access tokens for M2M
92+
client_credentials_grant_access_token_lifespan = "15m"
93+
94+
# Logout session tracking
95+
backchannel_logout_uri = "https://gateway.example.com/logout"
96+
backchannel_logout_session_required = true
97+
}
98+
8599
# Single Page Application (Public client with PKCE)
86100
resource "ory_oauth2_client" "spa" {
87101
client_name = "Single Page App"
@@ -166,12 +180,37 @@ The `subject_type` attribute controls how the `sub` claim is generated in ID tok
166180
| `public` | Same `sub` value across all clients (default) |
167181
| `pairwise` | Unique `sub` value per client (privacy-preserving) |
168182

183+
## Per-Grant Token Lifespans
184+
185+
Override default token lifespans on a per-client, per-grant basis using Go duration strings (e.g., `1h`, `30m`, `720h`):
186+
187+
| Grant Type | Access Token | ID Token | Refresh Token |
188+
|------------|-------------|----------|---------------|
189+
| Authorization Code | `authorization_code_grant_access_token_lifespan` | `authorization_code_grant_id_token_lifespan` | `authorization_code_grant_refresh_token_lifespan` |
190+
| Client Credentials | `client_credentials_grant_access_token_lifespan` |||
191+
| Device Authorization | `device_authorization_grant_access_token_lifespan` | `device_authorization_grant_id_token_lifespan` | `device_authorization_grant_refresh_token_lifespan` |
192+
| Implicit | `implicit_grant_access_token_lifespan` | `implicit_grant_id_token_lifespan` ||
193+
| JWT Bearer | `jwt_bearer_grant_access_token_lifespan` |||
194+
| Refresh Token | `refresh_token_grant_access_token_lifespan` | `refresh_token_grant_id_token_lifespan` | `refresh_token_grant_refresh_token_lifespan` |
195+
196+
If not set, the project-level defaults apply.
197+
198+
## OIDC Configuration
199+
200+
| Attribute | Description |
201+
|-----------|-------------|
202+
| `jwks_uri` | URL of the client's JSON Web Key Set, used with `private_key_jwt` authentication |
203+
| `userinfo_signed_response_alg` | JWS algorithm for signing UserInfo responses (e.g., `RS256`) |
204+
| `request_object_signing_alg` | JWS algorithm for signing request objects (e.g., `RS256`) |
205+
169206
## OIDC Logout
170207

171208
The provider supports both OIDC front-channel and back-channel logout:
172209

173210
- `frontchannel_logout_uri` — The client's URL that the OP will redirect the user-agent to after logout. The OP sends the logout request via the user's browser.
174211
- `backchannel_logout_uri` — The client's URL that the OP will call directly (server-to-server) to notify the client about a logout event.
212+
- `frontchannel_logout_session_required` — Whether the client requires a session identifier (`sid`) in front-channel logout notifications.
213+
- `backchannel_logout_session_required` — Whether the client requires a session identifier (`sid`) in back-channel logout notifications.
175214

176215
## Import
177216

@@ -195,23 +234,41 @@ terraform import ory_oauth2_client.api <client-id>
195234
- `access_token_strategy` (String) Access token strategy: jwt or opaque.
196235
- `allowed_cors_origins` (List of String) List of allowed CORS origins for this client.
197236
- `audience` (List of String) List of allowed audiences for tokens.
237+
- `authorization_code_grant_access_token_lifespan` (String) Access token lifespan for authorization code grant (e.g., '1h', '30m').
238+
- `authorization_code_grant_id_token_lifespan` (String) ID token lifespan for authorization code grant (e.g., '1h', '30m').
239+
- `authorization_code_grant_refresh_token_lifespan` (String) Refresh token lifespan for authorization code grant (e.g., '720h').
240+
- `backchannel_logout_session_required` (Boolean) Whether the client requires a session identifier in back-channel logout notifications.
198241
- `backchannel_logout_uri` (String) OpenID Connect back-channel logout URI.
242+
- `client_credentials_grant_access_token_lifespan` (String) Access token lifespan for client credentials grant (e.g., '1h', '30m').
199243
- `client_uri` (String) URL of the client's homepage.
200244
- `contacts` (List of String) List of contact email addresses for the client maintainers.
245+
- `device_authorization_grant_access_token_lifespan` (String) Access token lifespan for device authorization grant (e.g., '1h').
246+
- `device_authorization_grant_id_token_lifespan` (String) ID token lifespan for device authorization grant (e.g., '1h').
247+
- `device_authorization_grant_refresh_token_lifespan` (String) Refresh token lifespan for device authorization grant (e.g., '720h').
248+
- `frontchannel_logout_session_required` (Boolean) Whether the client requires a session identifier in front-channel logout notifications.
201249
- `frontchannel_logout_uri` (String) OpenID Connect front-channel logout URI.
202250
- `grant_types` (List of String) OAuth2 grant types: authorization_code, implicit, client_credentials, refresh_token.
251+
- `implicit_grant_access_token_lifespan` (String) Access token lifespan for implicit grant (e.g., '1h', '30m').
252+
- `implicit_grant_id_token_lifespan` (String) ID token lifespan for implicit grant (e.g., '1h', '30m').
253+
- `jwks_uri` (String) URL of the client's JSON Web Key Set for private_key_jwt authentication.
254+
- `jwt_bearer_grant_access_token_lifespan` (String) Access token lifespan for JWT bearer grant (e.g., '1h', '30m').
203255
- `logo_uri` (String) URL of the client's logo.
204256
- `metadata` (String) Custom metadata as JSON string.
205257
- `policy_uri` (String) URL of the client's privacy policy.
206258
- `post_logout_redirect_uris` (List of String) List of allowed post-logout redirect URIs for OpenID Connect logout.
207259
- `redirect_uris` (List of String) List of allowed redirect URIs for authorization code flow.
260+
- `refresh_token_grant_access_token_lifespan` (String) Access token lifespan for refresh token grant (e.g., '1h', '30m').
261+
- `refresh_token_grant_id_token_lifespan` (String) ID token lifespan for refresh token grant (e.g., '1h', '30m').
262+
- `refresh_token_grant_refresh_token_lifespan` (String) Refresh token lifespan for refresh token grant (e.g., '720h').
263+
- `request_object_signing_alg` (String) JWS algorithm for signing request objects (e.g., 'RS256', 'ES256').
208264
- `response_types` (List of String) OAuth2 response types: code, token, id_token.
209265
- `scope` (String) Space-separated list of OAuth2 scopes. If not specified, the API will set a default scope.
210266
- `skip_consent` (Boolean) Skip the consent screen for this client. When true, the user is never asked to grant consent.
211267
- `skip_logout_consent` (Boolean) Skip the logout consent screen for this client. When true, the user is not asked to confirm logout.
212268
- `subject_type` (String) OpenID Connect subject type: public (same sub for all clients) or pairwise (unique sub per client).
213269
- `token_endpoint_auth_method` (String) Token endpoint authentication method: client_secret_post, client_secret_basic, private_key_jwt, none.
214270
- `tos_uri` (String) URL of the client's terms of service.
271+
- `userinfo_signed_response_alg` (String) JWS algorithm for signing UserInfo responses (e.g., 'RS256', 'ES256').
215272

216273
### Read-Only
217274

docs/resources/project_config.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,28 @@ This resource supports CORS configuration for both public and admin endpoints:
184184
- The `project_id` attribute forces replacement if changed (you cannot move config to a different project)
185185
- After `terraform import`, run `terraform plan` to reconcile your configuration with the current API state
186186

187+
## Coverage and Limitations
188+
189+
This resource exposes **60+ attributes** across 11 configuration categories:
190+
191+
| Category | Examples |
192+
|----------|---------|
193+
| Password settings | min length, identifier similarity, max breaches, haveibeenpwned |
194+
| Session settings | cookie same site, lifespan, whoami-required AAL |
195+
| CORS | public and admin origins, enabled/disabled |
196+
| Authentication | passwordless, code, TOTP, passkey, WebAuthn, lookup secrets |
197+
| Recovery / Verification | enabled, methods, notify unknown recipients |
198+
| Account enumeration | mitigation enabled |
199+
| Keto | namespace configuration |
200+
201+
### Not Yet Exposed
202+
203+
Some Ory project settings are not yet available through this resource. For settings not listed above, use one of these workarounds:
204+
205+
- **Ory Console**[console.ory.sh](https://console.ory.sh)
206+
- **Ory CLI**`ory patch project --replace '/services/identity/config/...'`
207+
- **API**`PATCH /projects/{project_id}` with JSON Patch operations
208+
187209
<!-- schema generated by tfplugindocs -->
188210
## Schema
189211

docs/resources/relationship.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ terraform import ory_relationship.user_can_view "documents:doc-123#viewer@user-4
143143
terraform import ory_relationship.editors_can_view "documents:doc-123#viewer@folders:folder-789#editor"
144144
```
145145

146+
## API Details
147+
148+
This resource manages Keto relationship tuples via the `/admin/relation-tuples` API endpoint. Authentication requires a **Project API Key** (`ory_pat_...`).
149+
150+
For debugging, you can interact with the API directly:
151+
152+
```shell
153+
# List relationships in a namespace
154+
curl -s -H "Authorization: Bearer $ORY_PROJECT_API_KEY" \
155+
"https://${ORY_PROJECT_SLUG}.projects.oryapis.com/admin/relation-tuples?namespace=${NAMESPACE}"
156+
157+
# Check a specific permission
158+
curl -s -H "Authorization: Bearer $ORY_PROJECT_API_KEY" \
159+
"https://${ORY_PROJECT_SLUG}.projects.oryapis.com/relation-tuples/check?namespace=${NAMESPACE}&object=${OBJECT}&relation=${RELATION}&subject_id=${SUBJECT_ID}"
160+
```
161+
146162
<!-- schema generated by tfplugindocs -->
147163
## Schema
148164

examples/resources/ory_oauth2_client/resource.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ resource "ory_oauth2_client" "web_app" {
6464
})
6565
}
6666

67+
# Client with custom token lifespans
68+
resource "ory_oauth2_client" "api_gateway" {
69+
client_name = "API Gateway"
70+
grant_types = ["client_credentials"]
71+
scope = "api:read api:write"
72+
73+
# Short-lived access tokens for M2M
74+
client_credentials_grant_access_token_lifespan = "15m"
75+
76+
# Logout session tracking
77+
backchannel_logout_uri = "https://gateway.example.com/logout"
78+
backchannel_logout_session_required = true
79+
}
80+
6781
# Single Page Application (Public client with PKCE)
6882
resource "ory_oauth2_client" "spa" {
6983
client_name = "Single Page App"

0 commit comments

Comments
 (0)