Commit e20dc90
fix: handle multiple X-Maas-Subscription header values from Authorino
When clients send x-maas-subscription header (even empty string),
Authorino appends its injected value, resulting in multiple header values.
Gin's GetHeader() returns only the first value, which could be the client's
empty/incorrect value instead of Authorino's validated subscription.
This fix iterates header values in reverse order and takes the last
non-empty value, ensuring we use Authorino's injected subscription
when available.
Fixes:
- test_empty_subscription_header_value: now correctly auto-selects subscription
- test_api_key_ignores_subscription_header: now correctly uses API key's bound subscription
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 7e839d7 commit e20dc90
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
| |||
0 commit comments