26
26
27
27
package org .springdoc .webflux .ui ;
28
28
29
- import java .util .Map ;
30
-
31
29
import io .swagger .v3 .oas .annotations .Operation ;
32
- import org .apache .commons .lang3 .StringUtils ;
33
30
import org .springdoc .core .properties .SpringDocConfigProperties ;
34
31
import org .springdoc .core .properties .SwaggerUiConfigParameters ;
35
32
import org .springdoc .core .properties .SwaggerUiConfigProperties ;
36
- import reactor .core .publisher .Mono ;
37
-
38
33
import org .springframework .boot .actuate .autoconfigure .endpoint .web .WebEndpointProperties ;
39
- import org .springframework .boot .actuate .autoconfigure .web .server .ManagementServerProperties ;
40
34
import org .springframework .boot .actuate .endpoint .web .annotation .ControllerEndpoint ;
41
35
import org .springframework .http .MediaType ;
42
36
import org .springframework .http .server .reactive .ServerHttpRequest ;
43
37
import org .springframework .http .server .reactive .ServerHttpResponse ;
44
38
import org .springframework .web .bind .annotation .GetMapping ;
45
39
import org .springframework .web .bind .annotation .ResponseBody ;
46
- import org .springframework .web .util .UriComponentsBuilder ;
40
+ import reactor .core .publisher .Mono ;
41
+
42
+ import java .util .Map ;
47
43
48
44
import static org .springdoc .core .utils .Constants .DEFAULT_API_DOCS_ACTUATOR_URL ;
49
45
import static org .springdoc .core .utils .Constants .DEFAULT_SWAGGER_UI_ACTUATOR_PATH ;
@@ -68,26 +64,18 @@ public class SwaggerWelcomeActuator extends SwaggerWelcomeCommon {
68
64
*/
69
65
private final WebEndpointProperties webEndpointProperties ;
70
66
71
- /**
72
- * The Management server properties.
73
- */
74
- private final ManagementServerProperties managementServerProperties ;
75
-
76
67
/**
77
68
* Instantiates a new Swagger welcome.
78
69
*
79
- * @param swaggerUiConfig the swagger ui config
80
- * @param springDocConfigProperties the spring doc config properties
81
- * @param webEndpointProperties the web endpoint properties
82
- * @param managementServerProperties the management server properties
70
+ * @param swaggerUiConfig the swagger ui config
71
+ * @param springDocConfigProperties the swagger ui config parameters
72
+ * @param webEndpointProperties the web endpoint properties
83
73
*/
84
74
public SwaggerWelcomeActuator (SwaggerUiConfigProperties swaggerUiConfig
85
75
, SpringDocConfigProperties springDocConfigProperties ,
86
- WebEndpointProperties webEndpointProperties ,
87
- ManagementServerProperties managementServerProperties ) {
76
+ WebEndpointProperties webEndpointProperties ) {
88
77
super (swaggerUiConfig , springDocConfigProperties );
89
78
this .webEndpointProperties = webEndpointProperties ;
90
- this .managementServerProperties = managementServerProperties ;
91
79
}
92
80
93
81
/**
@@ -104,12 +92,11 @@ public Mono<Void> redirectToUi(ServerHttpRequest request, ServerHttpResponse res
104
92
return super .redirectToUi (request , response );
105
93
}
106
94
107
-
108
95
/**
109
- * Gets swagger ui config .
96
+ * Openapi yaml map .
110
97
*
111
98
* @param request the request
112
- * @return the swagger ui config
99
+ * @return the map
113
100
*/
114
101
@ Operation (hidden = true )
115
102
@ GetMapping (value = SWAGGER_CONFIG_ACTUATOR_URL , produces = MediaType .APPLICATION_JSON_VALUE )
@@ -120,23 +107,15 @@ public Map<String, Object> getSwaggerUiConfig(ServerHttpRequest request) {
120
107
}
121
108
122
109
@ Override
123
- protected void calculateUiRootPath (SwaggerUiConfigParameters swaggerUiConfigParameters ,StringBuilder ... sbUrls ) {
110
+ protected void calculateUiRootPath (SwaggerUiConfigParameters swaggerUiConfigParameters , StringBuilder ... sbUrls ) {
124
111
StringBuilder sbUrl = new StringBuilder ();
125
112
sbUrl .append (webEndpointProperties .getBasePath ());
126
- calculateUiRootCommon (swaggerUiConfigParameters ,sbUrl , sbUrls );
127
- }
128
-
129
- @ Override
130
- protected void calculateOauth2RedirectUrl (SwaggerUiConfigParameters swaggerUiConfigParameters , UriComponentsBuilder uriComponentsBuilder ) {
131
- if (StringUtils .isBlank (swaggerUiConfig .getOauth2RedirectUrl ()) || !swaggerUiConfigParameters .isValidUrl (swaggerUiConfig .getOauth2RedirectUrl ())) {
132
- UriComponentsBuilder oauthPrefix = uriComponentsBuilder .path (managementServerProperties .getBasePath () + swaggerUiConfigParameters .getUiRootPath ()).path (webJarsPrefixUrl );
133
- swaggerUiConfigParameters .setOauth2RedirectUrl (oauthPrefix .path (getOauth2RedirectUrl ()).build ().toString ());
134
- }
113
+ calculateUiRootCommon (swaggerUiConfigParameters , sbUrl , sbUrls );
135
114
}
136
115
137
116
@ Override
138
117
protected void buildApiDocUrl (SwaggerUiConfigParameters swaggerUiConfigParameters ) {
139
- swaggerUiConfigParameters .setApiDocsUrl ( buildUrl (swaggerUiConfigParameters .getContextPath () + webEndpointProperties .getBasePath (), DEFAULT_API_DOCS_ACTUATOR_URL ));
118
+ swaggerUiConfigParameters .setApiDocsUrl (buildUrl (swaggerUiConfigParameters .getContextPath () + webEndpointProperties .getBasePath (), DEFAULT_API_DOCS_ACTUATOR_URL ));
140
119
}
141
120
142
121
@ Override
0 commit comments