Commit 509b016
authored
Added check to handle token parsing with claims without "sub". (#3287)
### Description
In the oidc_introspection.py `func (filter *oidcIntrospectionFilter)
Request(ctx filters.FilterContext)` function get value form the Claim
map using `sub` key and then casts the value into a string, but this
would panic if no sub key is present. I added a check to ensure we only
cast values if sub key is present.
### Linked Issue
closes #3216
### Approach to solution
As describe in the following
[comment](#3216 (comment)),
I dug a bit deeper and found 2 suitable values to use if subject is not
present in token. One is the Subject value in tokenContainer struct or
UserInfo Struct. I decided to go with the tokenContainer struct. If this
is not correct please do guide me if UserInfo Struct would be better.
---------
Signed-off-by: wassafshahzad <wassafshahzad@gmail.com>1 parent 91c0bae commit 509b016
3 files changed
Lines changed: 32 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
| |||
292 | 304 | | |
293 | 305 | | |
294 | 306 | | |
295 | | - | |
| 307 | + | |
296 | 308 | | |
297 | 309 | | |
298 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
| |||
571 | 576 | | |
572 | 577 | | |
573 | 578 | | |
574 | | - | |
| 579 | + | |
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
| |||
924 | 929 | | |
925 | 930 | | |
926 | 931 | | |
927 | | - | |
| 932 | + | |
928 | 933 | | |
929 | 934 | | |
930 | 935 | | |
| |||
0 commit comments