Repository navigation
Add option to keep Authorization header on requests - #1488
bdunleavy22 wants to merge 3 commits into
Conversation
Add option to keep Authorization header on requests
|
Thanks for the PR, this makes sense as an opt-in for gateways that validate the token on every request. A few things before we merge:
Happy to merge once those are in. |
…oken - Parse keep_authorization_header with translate_to_boolean, so a config.ini value of "False" no longer switches it on. - Document keep_authorization_header as an option for token-based gateways (e.g. PAW's OAuth route), and document access_token. - Accept a zero-argument callable for access_token. It is resolved on every connect and reconnect, so a refreshing OAuth client supplies a fresh token after a session timeout instead of the stale one. - Add offline unit tests for the header being kept/removed, the "False" string, and the callable being resolved on each session start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks Marius, all three are in:
I also merged current master into the branch, and added one related change I'd like your view on: I tested both against real gateways, TM1 11.8 on IBM Cloud (PAW
|
|
Linking this to #1491 as this PR addresses and resolves the problem. |
Summary
Two opt-in changes for token-based gateways (e.g. PAW's OAuth route) that check the bearer token on every request,
not only at session start.
Evidence
Unit tests (offline):
Tests/RestService_authorization_header_test.pyAgainst real gateways with an OAuth user token (TM1 11.8 on IBM Cloud, TM1 12.5.9 PAaaS):
keep_authorization_headeroff): session starts, next request → 401 ("Failed to verify OAuth information"on v11, bare401+WWW-Authenticate: Beareron v12); logout → 401.whoami→ token forced to expire →re_connect()picks up arefreshed token →
whoami→ logout, all succeed on both.Merge Danger
Door: two-way
Both are opt-in; a string
access_tokenand the defaultkeep_authorization_header=Falsebehave as before.Blast Radius: minimal
Only
AuthenticationMode.ACCESS_TOKENsessions are touched. The one new failure mode is a callableaccess_tokenthat returns an empty token, which raises a
ValueErrornaming the kwarg.🤖 Generated with Claude Code