1

Our sonarqubeinstance deployed on a server which requires basic authentication. How we should configure sonar maven plugin in this case? Any combination of sonar.login and sonar.host.url (with or without user:password for server) will result in 401 error

alniks
  • 385
  • 2
  • 4
  • 12
  • Login to sonarqube server and [generate a token](https://docs.sonarqube.org/latest/user-guide/user-token/). Then provide this token as value of `sonar.login` property. Related [question](https://stackoverflow.com/questions/46114028/sonarqube-authorization-how-to-authorize-with-sonar-maven-plugin-when-sonar-fo?rq=1) – leopal Oct 31 '19 at 14:12
  • @leopal this results in 401 error – alniks Oct 31 '19 at 14:39

1 Answers1

0

The sonar-runner, even if configured with credentials, does not use these to make it's first call to the server. The endpoint is /batch/index. You have to allow public access to that endpoint. For all other urls basic auth is fine.

I have more details in my answer here: https://stackoverflow.com/a/60132667/1838233

Arigion
  • 3,267
  • 31
  • 41