Commit f06c110
committed
Improve authentication middleware and config structure
Added logic to handle cases where both API key and JWT token
are provided, returning a 409 Conflict status. Refactored
JWT token retrieval to use the `Authorization` header
directly. Updated `ValidateApiKeyAsync` to check the new
`Authorization:Enabled` flag and adjusted configuration
keys from `Authentication` to `Authorization`.
Enhanced `GetUserInfo` in `AuthenticateController` to handle
potential null references. Updated `appsettings.json` to
reflect the new `Authorization` section and added an
`enabled` flag for feature toggling.1 parent b20ca69 commit f06c110
File tree
3 files changed
+32
-11
lines changed- src
- Genocs.Auth
- demo/Genocs.Core.Demo.WebApi
- Controllers
3 files changed
+32
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
| |||
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 77 | + | |
| 78 | + | |
66 | 79 | | |
67 | | - | |
| 80 | + | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| |||
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
103 | 123 | | |
104 | | - | |
| 124 | + | |
105 | 125 | | |
106 | 126 | | |
107 | | - | |
| 127 | + | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
0 commit comments