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: MyApp/_pages/auth/admin-apikeys.md
+94-25Lines changed: 94 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,7 @@ that's easy for **Admin** Users to manage and control which trusted clients and
19
19
Simple Auth Story with API Keys ideal for .NET 8 Microservices
20
20
:::
21
21
22
-
The easiest way to get started is by creating a new Empty project with API Keys enabled with your preferred database
23
-
to store the API Keys in. SQLite is a good choice for stand-alone Apps as it doesn't require any infrastructure dependencies.
22
+
The easiest way to get started is by creating a new Empty project with API Keys enabled with your preferred database to store the API Keys in. SQLite is a good choice for stand-alone Apps as it doesn't require any infrastructure dependencies.
Which will add the [ServiceStack.Server](https://nuget.org/packages/ServiceStack.Server) dependency and the [Modular Startup](/modular-startup) configuration below:
## API Keys and Admin Secret Credentials Auth Provider
228
+
229
+
The usability of Simple Admin API Keys is greatly improved with the `ApiKeyCredentialsProvider` which enables .NET Microservices to provide persistent UserSession-like behavior for API Keys and Admin Auth Secrets to enable a Credentials Auth implementation which users can use with their API Keys or Admin AuthSecret.
230
+
231
+
When registered a **Credentials** SignIn dialog will appear for [ServiceStack Built-in UIs](https://servicestack.net/auto-ui) allowing users to Sign In with their **API Keys** or Admin **Auth Secret**.
Behind the scenes this creates a Server [Auth Session](/auth/sessions)
238
+
but instead of maintaining an Authenticated User Session it saves the API Key in the session then attaches the API Key to each request. This makes it possible to make API Key validated requests with just a session cookie instead of requiring resubmission of API Keys for each request.
239
+
240
+
### Secure .NET Microservices and Docker Appliances
241
+
242
+
This is an ideal Auth Configuration for .NET Docker Appliances and Microservices like [AI Server](/posts/ai-server) that don't need the complexity of ASP .NET Core's Identity Auth machinery and just want to restrict access to their APIs with API Keys and restrict Admin functionality to Administrator's with an Auth Secret.
243
+
244
+
The benefit of `ApiKeyCredentialsProvider` is that it maintains a persistent Session so that end users
245
+
only need to enter their API Key a single time and they'll be able to navigate to all of AI Server's protected pages using their API Key maintained in their Server User Session without needing to re-enter it for each UI and every request.
246
+
247
+
### User Access with API Keys
248
+
249
+
AI Server uses **API Keys** to restrict Access to their AI Features to **authorized Users** with Valid API Keys who
250
+
are able to use its Built-in UIs for its AI Features with the Users preferred Name and issued API Key:
0 commit comments