update 优化 springdoc 配置鉴权头写死问题 增加持久化鉴权头配置
parent
dbf79140ff
commit
a28741984b
|
|
@ -255,6 +255,11 @@ swagger:
|
|||
service-mapping:
|
||||
ruoyi-gen: /code
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
# 持久化认证数据
|
||||
persistAuthorization: true
|
||||
|
||||
# seata配置
|
||||
seata:
|
||||
# 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Swagger 文档配置
|
||||
|
|
@ -57,8 +54,11 @@ public class SwaggerAutoConfiguration {
|
|||
openApi.tags(swaggerProperties.getTags());
|
||||
openApi.paths(swaggerProperties.getPaths());
|
||||
openApi.components(swaggerProperties.getComponents());
|
||||
Set<String> keySet = swaggerProperties.getComponents().getSecuritySchemes().keySet();
|
||||
List<SecurityRequirement> list = new ArrayList<>();
|
||||
list.add(new SecurityRequirement().addList("apikey"));
|
||||
SecurityRequirement securityRequirement = new SecurityRequirement();
|
||||
keySet.forEach(securityRequirement::addList);
|
||||
list.add(securityRequirement);
|
||||
openApi.security(list);
|
||||
|
||||
return openApi;
|
||||
|
|
|
|||
Loading…
Reference in New Issue