Skip to content

Commit

Permalink
Added URL builder instead of building URL string manually
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-igarish committed Oct 21, 2023
1 parent 5703eec commit cacb73f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,13 @@ private String getSSOUrl(int port) throws SFException, SnowflakeSQLException {
private String getConsoleLoginUrl(int port) throws SFException {
try {
String serverUrl = loginInput.getServerUrl();
String consoleLoginUrl = serverUrl;
consoleLoginUrl += SessionUtil.SF_PATH_CONSOLE_LOGIN_REQUEST;
consoleLoginUrl += "?login_name=" + loginInput.getUserName();
consoleLoginUrl += "&client_port=" + port;

URIBuilder consoleLoginUriBuilder = new URIBuilder(serverUrl);
consoleLoginUriBuilder.setPath(SessionUtil.SF_PATH_CONSOLE_LOGIN_REQUEST);
consoleLoginUriBuilder.addParameter("login_name",loginInput.getUserName());
consoleLoginUriBuilder.addParameter("client_port",Integer.toString(port));

String consoleLoginUrl = consoleLoginUriBuilder.build().toURL().toString();

logger.debug("console login url: {}", consoleLoginUrl);

Expand Down

0 comments on commit cacb73f

Please sign in to comment.