From ee7599cbad9d39fd4f0e2da8f523d35ebfecf949 Mon Sep 17 00:00:00 2001
From: yangpeng <3074487626@qq.com>
Date: Fri, 9 Aug 2024 10:54:44 +0800
Subject: [PATCH] =?UTF-8?q?fix():=E5=A2=9E=E5=8A=A0=E9=89=B4=E6=9D=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 8 ---
.idea/compiler.xml | 13 ----
.idea/encodings.xml | 7 --
.idea/jarRepositories.xml | 45 ------------
.idea/misc.xml | 12 ----
.idea/vcs.xml | 6 --
.../api/doc/config/SpringDocConfig.java | 64 +++++++++++++++++-
...ot.autoconfigure.AutoConfiguration.imports | 1 -
.../api/doc/config/SpringDocConfig.class | Bin 1990 -> 0 bytes
target/cloud-common-api-doc-3.6.3.jar | Bin 3874 -> 0 bytes
target/maven-archiver/pom.properties | 5 --
.../compile/default-compile/createdFiles.lst | 1 -
.../compile/default-compile/inputFiles.lst | 1 -
13 files changed, 63 insertions(+), 100 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/compiler.xml
delete mode 100644 .idea/encodings.xml
delete mode 100644 .idea/jarRepositories.xml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 target/classes/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
delete mode 100644 target/classes/com/muyu/common/api/doc/config/SpringDocConfig.class
delete mode 100644 target/cloud-common-api-doc-3.6.3.jar
delete mode 100644 target/maven-archiver/pom.properties
delete mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
delete mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index b032f0d..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index aa00ffa..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index 38fd8e1..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 67e1e61..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/muyu/common/api/doc/config/SpringDocConfig.java b/src/main/java/com/muyu/common/api/doc/config/SpringDocConfig.java
index 08d7bff..cfa612e 100644
--- a/src/main/java/com/muyu/common/api/doc/config/SpringDocConfig.java
+++ b/src/main/java/com/muyu/common/api/doc/config/SpringDocConfig.java
@@ -1,11 +1,16 @@
package com.muyu.common.api.doc.config;
+import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.security.SecurityRequirement;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springdoc.core.customizers.GlobalOpenApiCustomizer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpHeaders;
@Configuration
public class SpringDocConfig {
@@ -29,6 +34,63 @@ public class SpringDocConfig {
public OpenAPI springShopOpenAPI() {
return new OpenAPI()
.info(info())
- .externalDocs(externalDocumentation());
+ .externalDocs(externalDocumentation())
+ // 配置全局鉴权参数-Authorize
+ .components(new Components()
+ .addSecuritySchemes(HttpHeaders.AUTHORIZATION,
+ new SecurityScheme()
+ .name(HttpHeaders.AUTHORIZATION)
+ .type(SecurityScheme.Type.APIKEY)
+ .in(SecurityScheme.In.HEADER)
+ .scheme("Bearer")
+ .bearerFormat("JWT")
+ )
+ );
}
+
+
+// /**
+// * 全局自定义扩展
+// *
+// * 在OpenAPI规范中,Operation 是一个表示 API 端点(Endpoint)或操作的对象。
+// * 每个路径(Path)对象可以包含一个或多个 Operation 对象,用于描述与该路径相关联的不同 HTTP 方法(例如 GET、POST、PUT 等)。
+// */
+// @Bean
+// public GlobalOpenApiCustomizer globalOpenApiCustomizer() {
+// return openApi -> {
+// // 全局添加鉴权参数
+// if (openApi.getPaths() != null) {
+// openApi.getPaths().forEach((s, pathItem) -> {
+// // 接口添加鉴权参数
+// pathItem.readOperations()
+// .forEach(operation ->
+// operation.addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION))
+// );
+// });
+// }
+// };
+// }
+ @Bean
+ public GlobalOpenApiCustomizer globalOpenApiCustomizer() {
+ return openApi -> {
+ // 全局添加鉴权参数
+ if (openApi.getPaths() != null) {
+ openApi.getPaths().forEach((s, pathItem) -> {
+ // 登录接口/验证码不需要添加鉴权参数
+ if (s.equals("/login") || s.equals("/code") || s.equals("/register")) {
+ return;
+ }
+ // 接口添加鉴权参数
+ pathItem.readOperations()
+ .forEach(operation ->
+ operation.addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION))
+ );
+ });
+ }
+ };
+ }
+
+
+
+
}
diff --git a/target/classes/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/target/classes/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
deleted file mode 100644
index 4b1b17b..0000000
--- a/target/classes/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ /dev/null
@@ -1 +0,0 @@
-com.muyu.common.api.doc.config.SpringDocConfig
\ No newline at end of file
diff --git a/target/classes/com/muyu/common/api/doc/config/SpringDocConfig.class b/target/classes/com/muyu/common/api/doc/config/SpringDocConfig.class
deleted file mode 100644
index 346124abceb9861700e6d45ac9f8ef21b927792b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1990
zcmb7F-E$LF6#v~OWz%$_u=W#cq1e{6+T21BfdE=su+`WishwebaJK0ty|^E7cN1hB
zXLNXQWGL|9IOE6+c917ViZf0SBlzy$VM5;g4;;@;VjD5k^04>woZtDKk9+p_zkYcH
z;5g>PXhJ|iP(?GgG3-3A=X7rBcAC#Eo;Q*{!?t6>7XAr_KxBA9L5N|WaJY9tPp1u+
z=f=6Cd)#uC4AbMnPC0yrhAlwk9oFr}Slt}YL#uavY%1KUE_6%)$CS!`E?hD7B
z)h&ZTi*K+`_)mv5FYJuI$0AW2^S{HyZ4OEM{YRP2>JTbB$k>57buUI_ar4!Ql&
zvFMnT8Bj4OWt5!ZdUUVgCCblJxu5#jH(XmcDK}Zmu>DF#!WfbTFv6hLQvX@u@ttqv
z@hg(TD8tmVg{Yw!3KwVSUH1Kqca-zA@C`lsk+3bH+fm0hg>6Wa`&Ar}CIea5RB(`C
z?^C^*%NX{=nVB%g5eQR>zNX?ZjxYpeZ8Ho-wv+i^n0
z>v)5q!)O$Bh69`NYaBw!^`wePOi{AxU_FNUO{g~p+kzVmJ!iAFFDzq0cw*5sCT!cO
zRt=dv7_bRVF<?uY4EoE02#v*`tuqmsT~!K+
zWhYb19mBw8iTNkP45JO*ryl52X6hY3Nf9Aa;e?ZQlg4Qw-DrQJNk(NqWH_`{%xY`R
zx|J6kLqFA96a6L_jnt!QK1I7$noraBriW<+X+b{@8fWN=)68gY9=Q+pBQ2Wn7LD>+
z>b*^)S`|PX?^N#TZPAHT{-7o|Sb%cwK3cSJ@FAMc1x9{?n)n%79^G1R9(`JW9xvXj
zC`<58vJWEH4h_B3?fYppK>H12gX_lV<MYQ2OUe=;{jBOxmq3
z7Ib3=dI+O$1ATSK
Zoi$_`Y#F*UG&kYh%6PVt0(qJM{syARIIaKy
diff --git a/target/cloud-common-api-doc-3.6.3.jar b/target/cloud-common-api-doc-3.6.3.jar
deleted file mode 100644
index 52e4799f6e36cc0a994c62e503641768a8a764dc..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 3874
zcmbtW2{@E{7atngmu%s-AXmlA*b3DsB4QZRpe$LYK}}PCwe
ziL#V!jNP?eMUgFHEcaG4-}^Q(o(FTE@B7a4yvsaue&?M3`M>|)`C(9Nph6JPv|L&C
zKVE*`1c9g30b3)uIoebM^V3ZLq6xT}Xod3o0Dp%Am-JFMDZ#Cgq7)(RUO?D
z1xGZAqTp)vbqxhr%~qY>0Se5bz8Z#t?-$_j&pMnat6r)S@I3W0Rtkl+p{1$iNpBFA
zOwhr~oROkqr=+82VAGbs{}wt_i_%98AM*orgU9G^rW8ZB7rAWjGz_Yn5t$YVd>-%|
zvQXjjg+PG{@nq8C8kT#2O9eehzJb16+$5H|0sbViHy3ZPF^fTedgFWuTo7`rAl%7#
zE~w31PcN=pI@
z{F%z;M+_4(-uOpq1l|irr6$?Eqe|IHfA>z%B@|)pze%ZMyoin@@AN1`2%Pk=twZ@v
z8t#mb?yzb}VQ0*X>xv)rGb_Tj7@y~_k~cg4I1H(UO+6JVSLV+WlVW~6+Z*8hsO7c7
z$-oZk*|e#&BbUo%_CjpILX##$G6$?hY)1J+Z
zIS!AU{_=IKImT(={$7py?@m_fbjTRyg!Xh)NSHg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#q)SB_WZVu^$H_$P_yC8rA
z$HObVW_3jgEC?_O$e0oMT>PXtu$2`i=nPuc`K`cx5w=8caw06(cc21f8<@BTcm-7q
zHw35%*#;s;f!9Ud!wm+?DYk(yN#O7V7pzNIZ$Nnvt=4FJIwcW+T|E|jve;#?>u>%0{2@`i#f`8WN^sc+>0
z#mQj0c6ojO@3`V*U;br+Q;2O65Ekp*((DT}X`wmG!Ap0W#S#Go`eJLB&8XF*fK!T7
z!hSAMRva{()vY|W7J_G;kNIyy|D0hv0beND;5uC;Ls%o#RqHv$W9WF
LVt_L+KWOYfp1UO$
diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties
deleted file mode 100644
index b6ac6dd..0000000
--- a/target/maven-archiver/pom.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated by Maven
-#Wed Jul 31 11:57:33 CST 2024
-groupId=com.muyu
-artifactId=cloud-common-api-doc
-version=3.6.3
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
deleted file mode 100644
index c1d7a69..0000000
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ /dev/null
@@ -1 +0,0 @@
-com\muyu\common\api\doc\config\SpringDocConfig.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
deleted file mode 100644
index fd7e2df..0000000
--- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ /dev/null
@@ -1 +0,0 @@
-C:\Users\杨旭飞\Desktop\ExpertHighnSix\disassemble\cloud-common-api-doc\src\main\java\com\muyu\common\api\doc\config\SpringDocConfig.java