Skip to content

Commit cf490f2

Browse files
committed
cleanup apikeys
1 parent 1747cb6 commit cf490f2

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

MyApp/_pages/auth/apikeys.md

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,13 @@
22
title: API Keys
33
---
44

5-
As we continue to embrace and natively integrate with ASP.NET Core's .NET 8 platform, we've reimplemented the last
6-
major feature missing from ServiceStack Auth - support for API Keys that's available from **ServiceStack v8.3**.
7-
8-
:::warning API Key Feature Vulnerability
9-
**ServiceStack v8.7+** resolves a vulnerability we've discovered in the management APIs of this API Keys feature, if using API Keys please upgrade as soon as possible.
10-
:::
11-
12-
### What are API Keys?
13-
14-
API Keys are a simple and effective way to authenticate and authorize access to your APIs, which are typically used
15-
for machine-to-machine communication, where a client application needs to access an API without user intervention.
5+
API Keys are a simple and effective way to authenticate and authorize access to your APIs, which are typically used for machine-to-machine communication, where a client application needs to access an API without user intervention.
166
API Keys are often used to control access to specific resources or features in your API, providing a simple way
177
to manage access control.
188

199
### Redesigning API Keys
2010

21-
Building on our experience with API Keys in previous versions of ServiceStack, we've taken the opportunity to redesign
22-
how API Keys work to provide a more flexible and powerful way to manage access control for your APIs.
11+
Building on our experience with API Keys in previous versions of ServiceStack, we've taken the opportunity to redesign how API Keys work to provide a more flexible and powerful way to manage access control for your APIs.
2312

2413
The existing [API Key Auth Provider](https://docs.servicestack.net/auth/api-key-authprovider) was implemented as
2514
another Auth Provider that provided another way to authenticate a single user. The consequences of this was:
@@ -43,7 +32,7 @@ where the new `ApiKeysFeature` is now just a plugin instead of an Auth Provider,
4332
Auth Apps with:
4433

4534
:::sh
46-
x mix apikeys
35+
npx add-in apikeys
4736
:::
4837

4938
Which will add the API Keys [Modular Startup](https://docs.servicestack.net/modular-startup) to your Host project, a minimal example of which looks like:
@@ -91,8 +80,7 @@ if (feature.ApiKeyCount(db) == 0)
9180

9281
### Basic Usage
9382

94-
With the plugin registered, you can now use the `ValidateApiKey` attribute to limit APIs to only be accessible with a
95-
valid API Key, e.g:
83+
With the plugin registered, you can now use the `ValidateApiKey` attribute to limit APIs to only be accessible with a valid API Key, e.g:
9684

9785
```csharp
9886
[ValidateApiKey]
@@ -101,15 +89,11 @@ public class MyRequest {}
10189

10290
### Use API Keys with our without Users and Authentication
10391

104-
API Keys can optionally be associated with a User, but they don't have to be, nor do they run in the context of a User
105-
or are able to invoke any Authenticated APIs on their own. Users who create them can also limit their scope to only
106-
call APIs they have access to, which can be done with user-defined scopes:
92+
API Keys can optionally be associated with a User, but they don't have to be, nor do they run in the context of a User or are able to invoke any Authenticated APIs on their own. Users who create them can also limit their scope to only call APIs they have access to, which can be done with user-defined scopes:
10793

10894
### Scopes
10995

110-
Scopes are user-defined strings that can be used to limit APIs from only being accessible with API Keys that have the
111-
required scope. For example, we could create generate API Keys that have **read only**, **write only** or **read/write**
112-
access to APIs by assigning them different scopes, e.g:
96+
Scopes are user-defined strings that can be used to limit APIs from only being accessible with API Keys that have the required scope. For example, we could create generate API Keys that have **read only**, **write only** or **read/write** access to APIs by assigning them different scopes, e.g:
11397

11498
```csharp
11599
public static class Scopes
@@ -502,4 +486,4 @@ Or use a different HTTP Header by configuring `ApiKeysFeature.HttpHeader`, e.g:
502486
services.AddPlugin(new ApiKeysFeature {
503487
HttpHeader = "X-Alt-Key"
504488
});
505-
```
489+
```

0 commit comments

Comments
 (0)