Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSwag 12.2 - SecurityDefinitionAppender is obsolete #1

Closed
reggiepangilinan opened this issue May 12, 2019 · 0 comments
Closed

NSwag 12.2 - SecurityDefinitionAppender is obsolete #1

reggiepangilinan opened this issue May 12, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@reggiepangilinan
Copy link
Owner

https://github.com/RicoSuter/NSwag/releases/tag/NSwag-Build-1059

            services.AddSwaggerDocument(c =>
            {
                c.DocumentName = "v1";
                c.Title = "Sample Api";
                c.Version = "v1";
                c.Description = "RESTFul Api for Sample";
                c.DocumentProcessors.Add(new SecurityDefinitionAppender("JWT", new SwaggerSecurityScheme
                {
                    Type = SwaggerSecuritySchemeType.ApiKey,
                    Name = "Authorization",
                    In = SwaggerSecurityApiKeyLocation.Header,
                    Description = "Copy 'Bearer ' + valid JWT token into field"
                }));
                c.OperationProcessors.Add(new OperationSecurityScopeProcessor("JWT"));
            });

should now be
https://github.com/RicoSuter/NSwag/wiki/AspNetCore-Middleware#enable-authorization-in-generator-and-swagger-ui

services.AddSwaggerDocument(document =>
{
    document.AddSecurity("JWT", Enumerable.Empty<string>(), new SwaggerSecurityScheme
    {
        Type = SwaggerSecuritySchemeType.ApiKey,
        Name = "Authorization",
        In = SwaggerSecurityApiKeyLocation.Header,
        Description = "Type into the textbox: Bearer {your JWT token}."
    });

    document.OperationProcessors.Add(
        new AspNetCoreOperationSecurityScopeProcessor("bearer"));
//      new OperationSecurityScopeProcessor("bearer"));
});
@reggiepangilinan reggiepangilinan self-assigned this May 12, 2019
@reggiepangilinan reggiepangilinan added the enhancement New feature or request label May 12, 2019
@reggiepangilinan reggiepangilinan added this to the 1.0.5 milestone May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant