Skip to content

Commit

Permalink
SLI-129 Login/password authentication fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dbmeneses committed Nov 18, 2016
1 parent 5443b0d commit b6b0bf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,20 @@ public Builder setEnableProxy(boolean enableProxy) {
}

public Builder setToken(@Nullable String token) {
this.token = PasswordUtil.encodePassword(token);
if (token == null) {
this.token = null;
} else {
this.token = PasswordUtil.encodePassword(token);
}
return this;
}

public Builder setPassword(@Nullable String password) {
this.password = PasswordUtil.encodePassword(password);
if (password == null) {
this.password = null;
} else {
this.password = PasswordUtil.encodePassword(password);
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static ServerConfiguration getServerConfiguration(SonarQubeServer server)
.connectTimeoutMilliseconds(CONNECTION_TIMEOUT_MS)
.readTimeoutMilliseconds(CONNECTION_TIMEOUT_MS)
.url(server.getHostUrl());
if (server.getToken() != null) {
if (StringUtil.isNotEmpty(server.getToken())) {
serverConfigBuilder.token(server.getToken());
} else {
serverConfigBuilder.credentials(server.getLogin(), server.getPassword());
Expand Down

0 comments on commit b6b0bf1

Please sign in to comment.