Commit cf11903
[oauth] Default to "sub" and "client_id" when preferred_username_claims is not configured (#1779)
### WHAT is this pull request doing?
Unlike RabbitMQs oauth2.0 implementation, LavinMQ does not have a
built-in default for `preferred_username_claims`. Without it set,
LavinMQ won't know which JWT claim to use as the username.
`DEBUG lmq.oauth2 authentication failed for user "": Could not decode
token - No username found in JWT claims (tried: )`
Hence, it needs to be set in the config. I think it would be a good idea
to fall back to 'sub', 'client_id' in those cases, as that is the
behavior for RabbitMQ .
### HOW can this pull request be tested?
Specs.
---------
Co-authored-by: Jon Börjesson <jon@84codes.com>1 parent efce866 commit cf11903
File tree
3 files changed
+21
-4
lines changed- spec
- src/lavinmq/config
3 files changed
+21
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| |||
0 commit comments