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

feat: Login to access Swagger documentation #7496

Merged
merged 1 commit into from
Dec 20, 2024
Merged

Conversation

lan-yonghui
Copy link
Member

No description provided.

Copy link

f2c-ci-robot bot commented Dec 20, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Dec 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wanghe-fit2cloud for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@1Panel-bot 1Panel-bot added the dev label Dec 20, 2024
@@ -175,7 +175,7 @@ func Routers() *gin.Engine {

swaggerRouter := Router.Group("1panel")
docs.SwaggerInfo.BasePath = "/api/v1"
swaggerRouter.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
swaggerRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
PublicGroup := Router.Group("")
{
PublicGroup.GET("/health", func(c *gin.Context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided diff shows changes that need to be addressed concerning function parameters and middleware usage:

  1. Middleware Usage Update:
    The line swaggerRouter.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) has been updated with middleware.JwtAuth(), middleware.SessionAuth(). This suggests adding authentication middleware before serving Swagger UI.

  2. Security Considerations:
    Adding authentication via JWT (middleware.JwtAuth()) ensures that only authorized users can access the Swagger interface, improving security.

  3. Session Authentication (if applicable):
    Ensuring session authenticity using middleware.SessionAuth() is another layer of protection, though this would depend on how session handling is implemented elsewhere in the application.

  4. Potential Performance Impact:
    While these changes improve security, they might introduce some performance overhead due to added HTTP handlers (authentication checks). It's important to measure if there's any significant impact and consider caching strategies where appropriate.

Overall, these modifications enhance both functionality and security but should be thoroughly tested to ensure they meet expectations without negatively affecting other parts of the system.

@zhengkunwang223 zhengkunwang223 merged commit d195ce9 into dev Dec 20, 2024
6 checks passed
@zhengkunwang223 zhengkunwang223 deleted the pr@dev@feat_swagger branch December 20, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants