Swagger UI更改和天蓝色功能的授权

问题描述

@H_502_0@我已经为带有功能启动功能的启动文件为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);
        }
@H_502_0@我正在尝试为无法使用的页面和授权实施不同的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"));
            });

            
        }
@H_502_0@我收到 Microsoft.AspNetCore.Authentication.Core的授权错误:没有为方案'WebJobsAuthLevel'注册任何身份验证处理程序。 而且我不确定如何注入css

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)