-
Notifications
You must be signed in to change notification settings - Fork 640
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
[Bug] OAuth2/OpenIDC Authentication failure #1291
Comments
We are currently on version 3.4.1-1 info from We looked at the class file Any other idea @To-om ? |
Before 3.4.1, authorization header contains "bearer" (not capitalized). I think that your OAuth server doesn't accept capitalized "bearer" |
@To-om seems that the bearer or Bearer token is fine .. |
Can you share your OAuth2 configuration (without secrets) ?
|
This is the redacted OAuth config ... The DEBUG level was already activated on our instance ...
|
De error message in the log file
|
My log looks similar, though my error from the IDP is slightly different (I'm not on ADFS). I get " oauth2 AuthenticationError unexpected response from server: 400" instead of the samaccountname error. My IDP's logs show a success grant of an oauth2 access token. I assume this means that it is failing when calling the /userinfo endpoint.
|
What's the best way to debug a call to userUrl? Based on the log statements and the 400 error returned by my IDP, I feel 99% sure this is a data format/configuration issue. I'm not familiar enough with Scala to recompile TheHive (so that I can build in additional logging commands). Is there another way to get more visibility from the existing binaries? |
@ddebast, according to your error message, you are using a TheHive version older than 3.4.1 which introduced better error logging. If you upgrade, you may be helped by a better log message. However, I think your problem is the one below: It seems that you configured the
Hoping I helped! 🙂 |
@hkelley, according to your second log line, you are also using a TheHive version older than 3.4.1 (the In my opinion, your problem is a different one: your IDP is responding with a 400 HTTP error which is specified in OAuth as an error. However, it is strange that the logged |
Request Type
Bug
Work Environment
Problem Description
oauth 2 configured in config file
ssologin appears on the TheHive login screen
Clicked the ssologin button
Request URL:
https://<the-hive-url>/api/ssoLogin
Status code: 200 OK
Request URL:
https://<adfs-url>/adfs/oauth2/authorize?scope=openid&response_type=code&redirect_uri=https%3A%2F%2F<the-hive-url>%2Foauth2&client_id=<clientid-secret-value>
Status code: 302 Found
Request URL:
https://<the-hive-url>/oauth2?code=<the-value-of-the-code>
Status code: 302 Moved Temporarily
Request URL:
https://<the-hive-url>/api/ssoLogin?code=<the-value-of-the-code>
Status code: 401 Unauthorized
That latest POST request https:///api/ssoLogin?code= returned 401
Since our ADFS does not support the "#" in the url we used the rewrite see documentation
documentation:
Redirect "/redirect_uri" "/index.html#!/login"
configuratiuon:
Redirect "/oauth2" "/index.html#!/login"
Complementary information
[error] o.e.s.a.MultiAuthSrv - Authentication failure org.elastic4play.AuthenticationError: Unexpected response from server: 401 at services.OAuth2Srv.$anonfun$getAuthTokenAndAuthenticate$6(OAuth2Srv.scala:122) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:303) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [info] o.e.ErrorHandler - POST /api/ssoLogin?code=<the-value-of-the-code> returned 401 org.elastic4play.AuthenticationError: Authentication failure at org.elastic4play.services.auth.MultiAuthSrv$$anonfun$authenticate$6.applyOrElse(MultiAuthSrv.scala:71) at org.elastic4play.services.auth.MultiAuthSrv$$anonfun$authenticate$6.applyOrElse(MultiAuthSrv.scala:67) at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:413) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
The text was updated successfully, but these errors were encountered: