feat[platform]: add fengling-api OAuth client for introspection
- Add RegisterApiClientAsync to seed OpenIddict applications - Register fengling-api client for Console backend token introspection - Client secret: fengling-api-secret (Confidential, with Introspection permission) This enables Console backend to validate tokens via introspection endpoint.
This commit is contained in:
parent
95bd5847f7
commit
e9b7a362e0
@ -85,6 +85,7 @@ public static class SeedData
|
|||||||
await RegisterCustomScopesAsync(scopeManager);
|
await RegisterCustomScopesAsync(scopeManager);
|
||||||
await RegisterVbenConsoleClientAsync(applicationManager);
|
await RegisterVbenConsoleClientAsync(applicationManager);
|
||||||
await RegisterSwaggerClientAsync(applicationManager);
|
await RegisterSwaggerClientAsync(applicationManager);
|
||||||
|
await RegisterApiClientAsync(applicationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task RegisterCustomScopesAsync(IOpenIddictScopeManager scopeManager)
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user