Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public final class Constants {
*/
public static final String INDEX_PAGE = "/index.html";

/**
* the constant OAUTH_REDIRECT_PAGE.
*/
public static final String OAUTH_REDIRECT_PAGE = "/oauth2-redirect.html";

/**
* The constant SWAGGER_UI_URL.
*/
Expand All @@ -201,7 +206,7 @@ public final class Constants {
/**
* The constant SWAGGER_UI_OAUTH_REDIRECT_URL.
*/
public static final String SWAGGER_UI_OAUTH_REDIRECT_URL = SWAGGER_UI_PREFIX + "/oauth2-redirect.html";
public static final String SWAGGER_UI_OAUTH_REDIRECT_URL = SWAGGER_UI_PREFIX + OAUTH_REDIRECT_PAGE;

/**
* The constant APPLICATION_OPENAPI_YAML.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.web.util.UriComponentsBuilder;

import static org.springdoc.core.Constants.INDEX_PAGE;
import static org.springdoc.core.Constants.OAUTH_REDIRECT_PAGE;
import static org.springdoc.core.Constants.SWAGGER_UI_OAUTH_REDIRECT_URL;
import static org.springdoc.core.Constants.SWAGGER_UI_PREFIX;
import static org.springdoc.core.Constants.SWAGGER_UI_URL;
Expand Down Expand Up @@ -221,7 +222,12 @@ protected void calculateUiRootCommon(StringBuilder sbUrl, StringBuilder[] sbUrls
* @return the oauth2 redirect url
*/
protected String getOauth2RedirectUrl() {
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_OAUTH_REDIRECT_URL);
if (StringUtils.isNotEmpty(swaggerUiConfig.getVersion())) {
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_PREFIX + DEFAULT_PATH_SEPARATOR + swaggerUiConfig.getVersion() + OAUTH_REDIRECT_PAGE);
}
else {
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_OAUTH_REDIRECT_URL);
}
}

/**
Expand Down