如何解决Swagger UI更改和天蓝色功能的授权
我已经为带有功能启动功能的启动文件为Azure函数应用实现了招摇,该启动文件具有用于配置的覆盖方法。
public override void Configure(IFunctionsHostBuilder builder)
{
builder.AddSwashBuckle(Assembly.GetExecutingAssembly(),opts =>
{
opts.SpecVersion = OpenApiSpecVersion.OpenApi3_0;
opts.AddCodeParameter = true;
opts.PrependOperationWithRoutePrefix = true;
opts.Documents = new[]
{
new SwaggerDocument
{
Name = "v1",Title = "Swagger document",Description = "Swagger test document",Version = "v2"
}
};
opts.Title = "Swagger Test";
//opts.OverridenPathToSwaggerJson = new Uri("http://localhost:7071/api/Swagger/json");
opts.ConfigureSwaggerGen = (x =>
{
x.CustomOperationIds(apiDesc =>
{
return apiDesc.TryGetMethodInfo(out MethodInfo methodInfo)
? methodInfo.Name
: new Guid().ToString();
});
});
});
ConfigureServices(builder.Services);
}
我正在尝试为无法使用的页面和授权实施不同的CSS。
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(opts =>
{
opts.Authority = $"auth-url";
opts.Audience = "key";
});
// see docs for more config options for AddJwtBearer
// Add security definition and scopes to document
services.AddOpenApiDocument(document =>
{
document.AddSecurity("bearer",Enumerable.Empty<string>(),new OpenApiSecurityScheme
{
Type = OpenApiSecuritySchemeType.OAuth2,Description = "B2C authentication",Flow = OpenApiOAuth2Flow.Implicit,Flows = new OpenApiOAuthFlows()
{
Implicit = new OpenApiOAuthFlow()
{
Scopes = new Dictionary<string,string>
{
{ "auth","Access the api as the signed-in user" },{ "auth","Read access to the API"},"Let's find out together!"}
},AuthorizationUrl = "auth",TokenUrl = "auth"
},}
});
document.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("bearer"));
});
}
我收到 Microsoft.AspNetCore.Authentication.Core的授权错误:没有为方案'WebJobsAuthLevel'注册任何身份验证处理程序。 而且我不确定如何注入css 。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。