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

add security scheme to endpoint /group/ middleware #221

Open
simonemastella opened this issue Nov 8, 2024 · 1 comment
Open

add security scheme to endpoint /group/ middleware #221

simonemastella opened this issue Nov 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@simonemastella
Copy link

I have encountered some issues adding the securityScheme to an api

After the line fuego.Use(restricted, util.MiddlewareJWT), I would like to add support for configuring OpenAPI security schemas, so that I can easily document the authentication requirements for the /ping endpoint.
Specifically, I'd like to be able to do something like this if is not possible directly inside the middleware:

goCopyrestricted := fuego.Group(s, "/")
fuego.Use(restricted, util.MiddlewareJWT)

// Add support for configuring OpenAPI security schemas
fuego.WithOpenAPISecuritySchemas(map[string]fuego.SecuritySchemaInfo{
    "jwt": {
        Type:        "http",
        Scheme:      "bearer",
        BearerFormat: "JWT",
        Description: "JWT Authorization header using the Bearer scheme.",
    },
})

fuego.Get(restricted, "/ping", c.Ping, fuego.WithOpenAPISecurity("jwt"))

This would allow me to clearly define the security requirements for the /ping endpoint in the OpenAPI documentation, making it easier for API consumers to understand how to authenticate and use the endpoint.

@simonemastella simonemastella added the enhancement New feature or request label Nov 8, 2024
@EwenQuim
Copy link
Member

EwenQuim commented Nov 9, 2024

Good idea.

I did not work on Security for a lomg time but this is a good idea, we'll try to do something about it.

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

2 participants