Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-4683. Change delimiter for reverse proxy group #2385

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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 @@ -23,4 +23,5 @@ interface RPConstants {
String PARAM_FIRST_NAME = "first-name-header";
String PARAM_LAST_NAME = "last-name-header";
String PARAM_ROLE_NAME = "role-header";
String PARAM_TEAM_DELIMITER = "team-delimiter";
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.auth.SMAuthInfo;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import org.jkiss.dbeaver.model.security.SMConstants;
import org.jkiss.dbeaver.model.security.SMController;
Expand All @@ -50,6 +51,7 @@
public class RPSessionHandler implements DBWSessionHandler {

private static final Log log = Log.getLog(RPSessionHandler.class);
public static final String DEFAULT_TEAM_DELIMITER = "\\|";

@Override
public boolean handleSessionOpen(WebSession webSession, HttpServletRequest request, HttpServletResponse response) throws DBException, IOException {
Expand Down Expand Up @@ -95,7 +97,9 @@ public void reverseProxyAuthentication(@NotNull HttpServletRequest request, @Not
String firstName = request.getHeader(resolveParam(paramConfigMap.get(RPConstants.PARAM_FIRST_NAME), RPAuthProvider.X_FIRST_NAME));
String lastName = request.getHeader(resolveParam(paramConfigMap.get(RPConstants.PARAM_LAST_NAME), RPAuthProvider.X_LAST_NAME));
String logoutUrl = Objects.requireNonNull(configuration).getParameter(RPConstants.PARAM_LOGOUT_URL);
List<String> userTeams = teams == null ? Collections.emptyList() : List.of(teams.split("\\|"));
String teamDelimiter = JSONUtils.getString(configuration.getParameters(),
RPConstants.PARAM_TEAM_DELIMITER, "\\|");
List<String> userTeams = teams == null ? Collections.emptyList() : List.of(teams.split(teamDelimiter));
if (userName != null) {
try {
Map<String, Object> credentials = new HashMap<>();
Expand Down
1 change: 1 addition & 0 deletions server/bundles/io.cloudbeaver.service.security/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<property id="logout-url" label="Logout url" type="string" description="Logout url"/>
<property id="user-header" label="User header name" type="string" description="User header name"/>
<property id="team-header" label="Team name" type="string" description="Team header name"/>
<property id="team-delimiter" label="Team delimiter symbol" type="string" description="Team delimiter symbol, default: |"/>
<property id="first-name-header" label="First name header" type="string" description="First name header name"/>
<property id="last-name-header" label="Last name header" type="string" description="Last name header name"/>
<property id="role-header" label="Role header" type="string" description="Role header name" features="distributed"/>
Expand Down
Loading