# HG changeset patch # User Kim Alvefur # Date 1683218493 -7200 # Node ID 2393dbae51ed9a7fba9fcd1f0edc19fa9dd13450 # Parent f8797e3284ff0f02d46f6247d0a09432394c1420 mod_http_oauth2: Add option for specifying TTL of registered clients Meant to simplify configuration, since TTL vs ignoring expiration is expected to be the main thing one would want to configure. Unsure what the implications of having unlimited lifetime of clients are, given no way to revoke them currently, short of rotating the signing secret. On one hand, it would be annoying to have the client expire. On the other hand, it is trivial to re-register it. diff -r f8797e3284ff -r 2393dbae51ed mod_http_oauth2/README.markdown --- a/mod_http_oauth2/README.markdown Wed May 03 10:55:22 2023 +0200 +++ b/mod_http_oauth2/README.markdown Thu May 04 18:41:33 2023 +0200 @@ -98,12 +98,12 @@ client registration. Dynamic client registration can be enabled by configuring a JWT key. Algorithm -defaults to *HS256*. +defaults to *HS256* lifetime defaults to forever. ```lua oauth2_registration_key = "securely generated JWT key here" oauth2_registration_algorithm = "HS256" -oauth2_registration_options = { default_ttl = 60 * 60 * 24 * 90 } +oauth2_registration_ttl = nil -- unlimited by default ``` ### Supported flows diff -r f8797e3284ff -r 2393dbae51ed mod_http_oauth2/mod_http_oauth2.lua --- a/mod_http_oauth2/mod_http_oauth2.lua Wed May 03 10:55:22 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Thu May 04 18:41:33 2023 +0200 @@ -77,7 +77,9 @@ -- Used to derive client_secret from client_id, set to enable stateless dynamic registration. local registration_key = module:get_option_string("oauth2_registration_key"); local registration_algo = module:get_option_string("oauth2_registration_algorithm", "HS256"); -local registration_options = module:get_option("oauth2_registration_options", { default_ttl = 60 * 60 * 24 * 90 }); +local registration_ttl = module:get_option("oauth2_registration_ttl", nil); +local registration_options = module:get_option("oauth2_registration_options", + { default_ttl = registration_ttl; accept_expired = not registration_ttl }); local pkce_required = module:get_option_boolean("oauth2_require_code_challenge", false);