hkamel / sonar-auth-aad

Azure Active Directory Authentication for SonarQube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Login fails with "User Must Be Authenticated"

sunmorgus opened this issue · comments

I'm attempting to get this plugin configured in my sonarqube instance, but can't get any further than just a loop on the login screen (i.e. when I click "Login with Azure AD", I just get sent back to the login page).

Here is a screenshot of my configuration screen:
image

And these are debug logs when I attempt to login...
2020.06.26 09:56:16 INFO web[AXLVpoJvqWT2DQLZADdF][o.s.s.l.ServerLogging] Level of logs changed to DEBUG 2020.06.26 09:56:19 DEBUG web[AXLVpoJvqWT2DQLZADdG][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@2a5675b5 pairs: {GET /systemInfo HTTP/1.1: null}{User-Agent: SonarQube 8.3.0.34182 # A0E315C3-AXHMWOmLm-BuGmsQm_EK Java/11.0.7}{Host: 127.0.0.1:57025}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive} 2020.06.26 09:56:20 DEBUG web[AXLVpoJvqWT2DQLZADdG][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@73ccf7765 pairs: {null: HTTP/1.1 200 OK}{Content-Type: application/x-protobuf}{Date: Fri, 26 Jun 2020 13:56:20 GMT}{Connection: keep-alive}{Content-Length: 8176} 2020.06.26 09:56:31 DEBUG web[AXLVpoJvqWT2DQLZADdH][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:32 DEBUG web[AXLVpoJvqWT2DQLZADdJ][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:32 DEBUG web[AXLVpoJvqWT2DQLZADdK][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:33 DEBUG web[AXLVpoJvqWT2DQLZADdM][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:45 DEBUG web[AXLVpoJvqWT2DQLZADdR][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:46 DEBUG web[AXLVpoJvqWT2DQLZADdT][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:46 DEBUG web[AXLVpoJvqWT2DQLZADdU][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:56:46 DEBUG web[AXLVpoJvqWT2DQLZADdW][auth.event] login failure [cause|User must be authenticated][method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|] 2020.06.26 09:57:33 INFO web[AXLVpoJvqWT2DQLZADdZ][o.s.s.l.ServerLogging] Level of logs changed to INFO

That is rather odd. It looks like there is possibly some configuration error, as it's not indicating any attempt to use the AAD login method. You can tell that by it saying the login attempt was a basic auth from the local system itself.

Your auth info:
[method|BASIC][provider|LOCAL|local][IP|0:0:0:0:0:0:0:1| ][login|]

My test auth info with the plugin (testing on my local dev system):
[auth.event] login success [method|OAUTH2][provider|EXTERNAL|Microsoft][IP|0:0:0:0:0:0:0:1|][login|63095]

One other thing you can check is the access.log file. If it's calling the AAD process correctly, you should see one get request to "/sessions/init/aad?return_to=%2F" that shows up after you click on the "Login with Microsoft" button, and then a get request to "/oauth2/callback/aad?code=code_here" after, which is the return from the MS auth flow. If you don't see that, then you're not even in that process flow.

Also, can you provide some information on your setup so I can try to reproduce the issue?

Thanks for the response, but I finally figured out my issue... I'm using reverse proxying with IIS and needed to do the following steps from the troubleshooting section in the wiki: https://github.com/hkamel/sonar-auth-aad/wiki/Troubleshooting#im-never-getting-sent-to-the-microsoft-login-page