diff --git a/Fengling.Platform.Infrastructure/SeedData.cs b/Fengling.Platform.Infrastructure/SeedData.cs index 751e14f..ad22840 100644 --- a/Fengling.Platform.Infrastructure/SeedData.cs +++ b/Fengling.Platform.Infrastructure/SeedData.cs @@ -85,6 +85,7 @@ public static class SeedData await RegisterCustomScopesAsync(scopeManager); await RegisterVbenConsoleClientAsync(applicationManager); await RegisterSwaggerClientAsync(applicationManager); + await RegisterApiClientAsync(applicationManager); } private static async Task RegisterCustomScopesAsync(IOpenIddictScopeManager scopeManager) @@ -193,4 +194,26 @@ public static class SeedData } }); } + + private static async Task RegisterApiClientAsync(IOpenIddictApplicationManager applicationManager) + { + var existingClient = await applicationManager.FindByClientIdAsync("fengling-api"); + if (existingClient != null) + { + return; + } + + await applicationManager.CreateAsync(new OpenIddictApplicationDescriptor + { + ClientId = "fengling-api", + ClientSecret = "fengling-api-secret", + DisplayName = "Fengling API (Resource Server)", + ApplicationType = OpenIddictConstants.ApplicationTypes.Web, + ClientType = OpenIddictConstants.ClientTypes.Confidential, + Permissions = + { + OpenIddictConstants.Permissions.Endpoints.Introspection + } + }); + } } \ No newline at end of file