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

Gitlab server url with login password is not authenticated #4

Open
acommuni opened this issue Jun 7, 2018 · 1 comment
Open

Gitlab server url with login password is not authenticated #4

acommuni opened this issue Jun 7, 2018 · 1 comment

Comments

@acommuni
Copy link

acommuni commented Jun 7, 2018

When using a gitlab url like -Dsonar.gitlab.url=https://user:password@gitlabserver the user:password is not sent to the server as standard Authorization header

See gabrie-allaigre/sonar-gitlab-plugin#147

@acommuni
Copy link
Author

acommuni commented Jun 7, 2018

See issue is located in GitLabHTTPRequestor in private HttpURLConnection setupConnection(URL url) throws IOException function

Just after creating the HttpURLConnection, the Authorization header could be set with the folling code

HttpURLConnection connection = root.getProxy() != null ? (HttpURLConnection) url.openConnection(root.getProxy()) : (HttpURLConnection) url.openConnection();
String userInfo = url.getUserInfo();
if (userInfo != null) {
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userInfo.getBytes()));
connection.setRequestProperty("Authorization", basicAuth);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant