:wave: I'm trying to configure the UI to use a pr...
# ui
h
👋 I'm trying to configure the UI to use a proper LoginModule,
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule
in this case. I'm however running into some errors that I cant figure out. Any tips on how to debug would be appreciated. Logs in thread.
Copy code
21:11:47 [application-akka.actor.default-dispatcher-6] WARN  application - Authentication error
javax.naming.AuthenticationException: javax.security.auth.login.LoginException: java.lang.NullPointerException
        at org.eclipse.jetty.jaas.spi.PropertyFileLoginModule.setupPropertyUserStore(PropertyFileLoginModule.java:78)
        at org.eclipse.jetty.jaas.spi.PropertyFileLoginModule.initialize(PropertyFileLoginModule.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:736)
        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
        at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
        at security.AuthenticationManager.authenticateUser(AuthenticationManager.java:27)
        at react.controllers.AuthenticationController.logIn(AuthenticationController.java:108)
        at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$32$$anonfun$apply$32.apply(Routes.scala:1041)
        at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$32$$anonfun$apply$32.apply(Routes.scala:1041)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:88)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction$$anonfun$9.apply(JavaAction.scala:138)
        at play.core.j.JavaAction$$anonfun$9.apply(JavaAction.scala:138)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.Future$.apply(Future.scala:31)
        at scala.concurrent.Future$.apply(Future.scala:494)
        at play.core.j.JavaAction.apply(JavaAction.scala:138)
        at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:96)
        at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:89)
        at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
        at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36)
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

        at security.AuthenticationManager.authenticateUser(AuthenticationManager.java:29)
        at react.controllers.AuthenticationController.logIn(AuthenticationController.java:108)
        at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$32$$anonfun$apply$32.apply(Routes.scala:1041)
        at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$32$$anonfun$apply$32.apply(Routes.scala:1041)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:134)
        at play.core.routing.HandlerInvokerFactory$$anon$3.resultCall(HandlerInvoker.scala:133)
        at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$8$$anon$2$$anon$1.invocation(HandlerInvoker.scala:108)
        at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:88)
        at play.http.DefaultActionCreator$1.call(DefaultActionCreator.java:31)
        at play.core.j.JavaAction$$anonfun$9.apply(JavaAction.scala:138)
        at play.core.j.JavaAction$$anonfun$9.apply(JavaAction.scala:138)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:56)
        at play.api.libs.streams.Execution$trampoline$.execute(Execution.scala:70)
        at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:48)
        at scala.concurrent.impl.Future$.apply(Future.scala:31)
        at scala.concurrent.Future$.apply(Future.scala:494)
        at play.core.j.JavaAction.apply(JavaAction.scala:138)
        at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:96)
        at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:89)
        at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
        at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36)
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
My
jaas.conf
Copy code
WHZ-Authentication {
  org.eclipse.jetty.jaas.spi.PropertyFileLoginModule sufficient
  debug="true"
  file="/datahub-frontend/conf/user.props";
};
and my
user.props
is simply
Copy code
datahub:dataub
I've maybe sure that the
user.props
file is available in the container.
b
Hm
You're sure youve mounted user.props file at this location inside the container:
file="/datahub-frontend/conf/user.props"
?
Can you verify that the file is indeed inside the container?
using
docker exec --privileged <container-id> ls -l /datahub-frontend/conf/
if you're using docker directly
@high-hospital-85984 Curious, were you able to get this working?
h
Unfortunately not. I did some digging, and I think this is the culprit: https://github.com/eclipse/jetty.project/blob/40535f1cd73beaa255c8b1807821ad7ffa38[…]in/java/org/eclipse/jetty/jaas/spi/PropertyFileLoginModule.java It seems like
JAASLoginService.INSTANCE.get()
returns null. If I'm reading the code of the
JAASLoginService
correctly, it's
login
function should be called first to initialize the
INSTANCE
-attribute, leading me to believe that this particular LoginModule is not compatible as is with Datahub's
AuthenticationManager
. Thoughts?
b
interesting let me follow the trail a bit more
So tryng to debug this now.. Looks like it may be because jetty-jaas is not on the classpath
I was able to get this working by adding
Copy code
'jettyJaas': 'org.eclipse.jetty:jetty-jaas:9.4.28.v20200408',
to the root build.gradle and then
Copy code
play externalDependency.jettyJaas
to the
play.gradle
dependencies
I will raise a PR for a reference impl. I think it's best to ship with a default file like this
h
I did something very similar, except i had
'jettyJaas': 'org.eclipse.jetty:jetty-jaas:9.4.42.v20210604'
, but good if you got it working. I'll try again with the older version
Yup, can confirm it works with the older version! Awesome!
Thanks @big-carpet-38439 for digging into this!
b