You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-6Lines changed: 25 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,7 +201,26 @@ With this configuration, authentication will succedd if any of these credentials
201
201
202
202
**Assigning roles to API Keys and Basic Authentication credentials**
203
203
204
-
You can optionally specify roles for each API Key or Basic Authentication credential. When authentication succeeds, the specified roles will be automatically added as role claims to the user's identity:
204
+
You can optionally specify roles for each API Key or Basic Authentication credential. When authentication succeeds, the specified roles will be automatically added as role claims to the user's identity.
205
+
206
+
For single credentials, you can specify roles directly:
207
+
208
+
```json
209
+
"Authentication": {
210
+
"ApiKey": {
211
+
"ApiKeyValue": "f1I7S5GXa4wQDgLQWgz0",
212
+
"UserName": "ApiUser",
213
+
"Roles": ["Administrator"]
214
+
},
215
+
"Basic": {
216
+
"UserName": "marco",
217
+
"Password": "P@$$w0rd",
218
+
"Roles": ["Administrator"]
219
+
}
220
+
}
221
+
```
222
+
223
+
For multiple credentials, you can specify roles for each credential:
205
224
206
225
```json
207
226
"Authentication": {
@@ -210,7 +229,7 @@ You can optionally specify roles for each API Key or Basic Authentication creden
210
229
{
211
230
"Value": "key-1",
212
231
"UserName": "UserName1",
213
-
"Roles": ["Admin", "User"]
232
+
"Roles": ["Administrator", "User"]
214
233
},
215
234
{
216
235
"Value": "key-2",
@@ -239,15 +258,15 @@ You can optionally specify roles for each API Key or Basic Authentication creden
239
258
The `Roles` parameter is optional. If omitted, no role claims will be added to the user's identity. You can then use the standard ASP.NET Core authorization features to check for roles:
0 commit comments