我希望范围复选框默认选中 swagger Nswag
I want scope checkbox checked by default swagger Nswag
这里是Swagger/OpenAPI定义:
services.AddOpenApiDocument(document =>
{
document.DocumentProcessors.Add(new SecurityDefinitionAppender("Bearer", Enumerable.Empty<string>(),
new OpenApiSecurityScheme
{
Type = OpenApiSecuritySchemeType.OAuth2,
Flow = OpenApiOAuth2Flow.AccessCode,
Scopes = new Dictionary<string, string> {{"myScope", "myScope"}},
AuthorizationUrl = "redacted",
TokenUrl = "redacted"
}));
});
和 Swagger-UI 配置选项:
app.UseSwaggerUi3(settings =>
{
settings.OAuth2Client = new OAuth2ClientSettings
{
ClientId = "MyClientID",
ClientSecret = string.Empty,
AppName = "My App",
UsePkceWithAuthorizationCodeGrant = true
};
});
我希望默认检查范围,这可能吗?
6.0版本可以通过OAuthScopes
方法实现。
这里是Swagger/OpenAPI定义:
services.AddOpenApiDocument(document =>
{
document.DocumentProcessors.Add(new SecurityDefinitionAppender("Bearer", Enumerable.Empty<string>(),
new OpenApiSecurityScheme
{
Type = OpenApiSecuritySchemeType.OAuth2,
Flow = OpenApiOAuth2Flow.AccessCode,
Scopes = new Dictionary<string, string> {{"myScope", "myScope"}},
AuthorizationUrl = "redacted",
TokenUrl = "redacted"
}));
});
和 Swagger-UI 配置选项:
app.UseSwaggerUi3(settings =>
{
settings.OAuth2Client = new OAuth2ClientSettings
{
ClientId = "MyClientID",
ClientSecret = string.Empty,
AppName = "My App",
UsePkceWithAuthorizationCodeGrant = true
};
});
我希望默认检查范围,这可能吗?
6.0版本可以通过OAuthScopes
方法实现。