This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Commit 91c65b6
committed
[Schema] Return 401 error when no HTTP authentication is configured (#1802)
[Schema] Return 401 error when no HTTP authentication is configured
### Motivation
When authentication is enabled, if the Schema REST requests were sent
without HTTP authentication header, the Schema Registry will return 404,
rather than 401.
### Modifications
- When `SchemaStorageException` is thrown, build the response with the
error code and the exception message.
- Add `testSchemaNoAuth` to verify 401 unauthorized will be returned.
(cherry picked from commit c41ad06)1 parent 0de01fc commit 91c65b6
3 files changed
Lines changed: 37 additions & 8 deletions
File tree
- schema-registry/src/main/java/io/streamnative/pulsar/handlers/kop/schemaregistry
- tests/src/test/java/io/streamnative/pulsar/handlers/kop
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
| |||
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
754 | 756 | | |
755 | 757 | | |
756 | 758 | | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
757 | 773 | | |
758 | 774 | | |
759 | 775 | | |
| |||
766 | 782 | | |
767 | 783 | | |
768 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
769 | 789 | | |
770 | 790 | | |
771 | 791 | | |
| |||
782 | 802 | | |
783 | 803 | | |
784 | 804 | | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
790 | 810 | | |
791 | 811 | | |
792 | 812 | | |
| |||
0 commit comments