增加鉴权

master
zhang chengzhi 2024-08-08 09:44:58 +08:00
parent 8ea2902ec5
commit cd89e21aed
1 changed files with 19 additions and 19 deletions

View File

@ -39,25 +39,25 @@ public class SpringDocConfig {
// @Bean @Bean
// public GlobalOpenApiCustomizer globalOpenApiCustomizer() { public GlobalOpenApiCustomizer globalOpenApiCustomizer() {
// return openApi -> { return openApi -> {
// // 全局添加鉴权参数 // 全局添加鉴权参数
// if (openApi.getPaths() != null) { if (openApi.getPaths() != null) {
// openApi.getPaths().forEach((s, pathItem) -> { openApi.getPaths().forEach((s, pathItem) -> {
// // 登录接口/验证码不需要添加鉴权参数 // 登录接口/验证码不需要添加鉴权参数
// if (s.equals("/login") || s.equals("/code") ||s.equals("/register")) { if (s.equals("/login") || s.equals("/code") ||s.equals("/register")) {
// return; return;
// } }
// // 接口添加鉴权参数 // 接口添加鉴权参数
// pathItem.readOperations() pathItem.readOperations()
// .forEach(operation -> .forEach(operation ->
// operation.addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION)) operation.addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION))
// ); );
// }); });
// } }
// }; };
// } }
// @Bean // @Bean