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

刷新swagger-ui 后 Authorize 会失效 #214

Open
Xuguozong opened this issue Jun 2, 2021 · 0 comments
Open

刷新swagger-ui 后 Authorize 会失效 #214

Xuguozong opened this issue Jun 2, 2021 · 0 comments

Comments

@Xuguozong
Copy link

Xuguozong commented Jun 2, 2021

上传文件接口测试的时候,如果先在swagger-ui中选定文件,再在编辑器或其他软件中修改了文件内容并保存,然后再测试接口会有 TypeError: Failed to fetch 的错误,这时就需要刷新swagger-ui,刷新了swagger-ui后配置的token方式的Authorize就失效了。看了提供的配置项好像不能解决这个问题。

  1. swagger 配置:
    swagger:
    enabled: true
    title:xxxxx
    description:
    version: xxxxx
    contact.name: xxxxxx
    base-package: xxxxxx
    base-path: /api/,/rest/
    exclude-path: /error, /ops/**
    authorization:
    name: Authorization # 鉴权策略ID,对应 SecurityReferences ID
    type: ApiKey # 鉴权策略,可选 ApiKey | BasicAuth | None,默认ApiKey
    key-name: token # 鉴权传递的Header参数

  2. swagger-spring-boot-starter 版本:1.9.1.RELEASE

  3. Rest 层
    @PostMapping("/excel/import")
    public Rimport(@RequestParam("uploadFile") MultipartFile file) {
    checkUploadFile(file, ".xlsx");
    return new R<>(xxxService.doImport(currentUser(), file));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant