Skip to content

Commit

Permalink
Update Configure.ApiKeys.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jun 3, 2024
1 parent cf02421 commit 2ce4818
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions MyApp/Configure.ApiKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ public void Configure(IWebHostBuilder builder) => builder
{
services.AddPlugin(new ApiKeysFeature
{
Features = [
"Tracking"
],
// Optional: Limit available Scopes Admin Users can assign to any API Keys
// Features = [
// "Paid",
// "Tracking",
// ],
// Optional: Limit available Features Admin Users can assign to any API Keys
// Scopes = [
// "todo:read",
// "todo:write",
// ],

// Optional: Limit scope of API Key access
UserScopes = [
"todo:read",
"todo:write",
],
// Optional: Tag API Keys with additional features
UserFeatures = [
"Tracking",
],
// Optional: Limit available Scopes Users can assign to their own API Keys
// UserScopes = [
// "todo:read",
// "todo:write",
// ],
// Optional: Limit available Features Users can assign to their own API Keys
// UserFeatures = [
// "Paid",
// "Tracking",
// ],
});
})
.ConfigureAppHost(appHost =>
Expand All @@ -35,7 +43,7 @@ public void Configure(IWebHostBuilder builder) => builder
using var db = appHost.Resolve<IDbConnectionFactory>().Open();
apiKeysFeature.InitSchema(db);

// Optional, create API Key for specified Users
// Optional: Create API Key for specified Users on Startup
if (apiKeysFeature.ApiKeyCount(db) == 0)
{
var createApiKeysFor = new [] { "[email protected]", "[email protected]" };
Expand Down

0 comments on commit 2ce4818

Please sign in to comment.