Skip to content

Commit

Permalink
CB-4683. Change delimiter for reverse proxy group (#2385)
Browse files Browse the repository at this point in the history
* CB-4683. Change delimiter for reverse proxy group

* CB-4683. Refactor after review. Added new parameter team delimiter for reverse proxy identity provider,

---------

Co-authored-by: DenisSinelnikov <[email protected]>
  • Loading branch information
DenisSinelnikov and DenisSinelnikov authored Feb 19, 2024
1 parent 9c54fb1 commit 6d6ab69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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

0 comments on commit 6d6ab69

Please sign in to comment.