@@ -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)
86100resource "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
171208The 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
0 commit comments