@@ -273,22 +273,27 @@ bool oauth2_http_ctx_auth_add(oauth2_log_t *log, oauth2_http_call_ctx_t *ctx,
273
273
274
274
_OAUTH2_CFG_CTX_TYPE_START (oauth2_introspect_ctx )
275
275
oauth2_cfg_endpoint_t * endpoint ;
276
+ char * token_param_name ;
276
277
oauth2_nv_list_t * params ;
277
278
_OAUTH2_CFG_CTX_TYPE_END (oauth2_introspect_ctx )
278
279
279
280
_OAUTH2_CFG_CTX_INIT_START (oauth2_introspect_ctx )
280
281
ctx -> endpoint = NULL ;
282
+ ctx -> token_param_name = NULL ;
281
283
ctx -> params = NULL ;
282
284
_OAUTH2_CFG_CTX_INIT_END
283
285
284
286
_OAUTH2_CFG_CTX_CLONE_START (oauth2_introspect_ctx )
285
287
dst -> endpoint = oauth2_cfg_endpoint_clone (log , src -> endpoint );
288
+ dst -> token_param_name = oauth2_strdup (src -> token_param_name );
286
289
dst -> params = oauth2_nv_list_clone (log , src -> params );
287
290
_OAUTH2_CFG_CTX_CLONE_END
288
291
289
292
_OAUTH2_CFG_CTX_FREE_START (oauth2_introspect_ctx )
290
293
if (ctx - > endpoint )
291
294
oauth2_cfg_endpoint_free (log , ctx - > endpoint );
295
+ if (ctx -> token_param_name )
296
+ oauth2_mem_free (ctx - > token_param_name );
292
297
if (ctx -> params )
293
298
oauth2_nv_list_free (log , ctx - > params );
294
299
_OAUTH2_CFG_CTX_FREE_END
@@ -331,7 +336,10 @@ static bool _oauth2_introspect_verify(oauth2_log_t *log,
331
336
if (params == NULL )
332
337
goto end ;
333
338
334
- oauth2_nv_list_add (log , params , OAUTH2_INTROSPECT_TOKEN , token );
339
+ oauth2_nv_list_add (log , params ,
340
+ ctx -> token_param_name ? ctx -> token_param_name
341
+ : OAUTH2_INTROSPECT_TOKEN ,
342
+ token );
335
343
oauth2_nv_list_add (log , params , OAUTH2_INTROSPECT_TOKEN_TYPE_HINT ,
336
344
OAUTH2_INTROSPECT_TOKEN_TYPE_HINT_ACCESS_TOKEN );
337
345
@@ -442,6 +450,9 @@ static char *_oauth2_verify_options_set_introspect_url_ctx(
442
450
rv = oauth2_cfg_set_endpoint (log , ctx -> endpoint , url , params ,
443
451
"introspect" );
444
452
453
+ ctx -> token_param_name = oauth2_strdup (
454
+ oauth2_nv_list_get (log , params , "introspect.token_param_name" ));
455
+
445
456
if (oauth2_parse_form_encoded_params (
446
457
log , oauth2_nv_list_get (log , params , "introspect.params" ),
447
458
& ctx -> params ) == false)
0 commit comments