Skip to content

Commit

Permalink
CB-5559 include root uri in redirect urls (#2950)
Browse files Browse the repository at this point in the history
Co-authored-by: Daria Marutkina <[email protected]>
  • Loading branch information
yagudin10 and dariamarutkina authored Oct 1, 2024
1 parent bb9a62d commit 3fbc227
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public String getSignInLink() throws DBException {
}

private String buildRedirectUrl(String baseUrl) {
return baseUrl + "?" + CBAuthConstants.CB_REDIRECT_URL_REQUEST_PARAM + "=" + WebAppUtils.getWebApplication().getServerURL();
return baseUrl + "?" + CBAuthConstants.CB_REDIRECT_URL_REQUEST_PARAM + "=" + WebAppUtils.getFullServerUrl();
}

@Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

import java.nio.file.Path;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class WebAppUtils {
private static final Log log = Log.getLog(WebAppUtils.class);
Expand Down Expand Up @@ -269,4 +271,13 @@ private static void flattenArray(Object[] array, Map<String, Object> result, Str
}
}

@NotNull
public static String getFullServerUrl() {
WebApplication application = WebAppUtils.getWebApplication();
return Stream.of(application.getServerURL(), application.getRootURI())
.map(WebAppUtils::removeSideSlashes)
.filter(CommonUtils::isNotEmpty)
.collect(Collectors.joining("/"));
}

}

0 comments on commit 3fbc227

Please sign in to comment.