Netty4 HTTP - JAAS issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Netty4 HTTP - JAAS issue

Charles Moulliard-2
Hi,

I have designed a Camel REST DSL route using the Netty4 HTTP component and
SSL. The Junit Test case works very well when I launch it within IntelliJ
but it fails when I run the "mvn test" goal

[ #77 - NettyEventExecutorGroup] JAASSecurityAuthenticator      TRACE Login
username: mickey using realm: myrealm
[ #77 - NettyEventExecutorGroup] NettyHttpConsumer              DEBUG
Cannot login mickey due No LoginModules configured for myrealm
javax.security.auth.login.LoginException: No LoginModules configured for
myrealm
        at
javax.security.auth.login.LoginContext.init(LoginContext.java:264)
        at
javax.security.auth.login.LoginContext.<init>(LoginContext.java:417)
        at
org.apache.camel.component.netty4.http.JAASSecurityAuthenticator.login(JAASSecurityAuthenticator.java:42)
        at
org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler.authenticate(HttpServerChannelHandler.java:265)
        at
org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler.channelRead0(HttpServerChannelHandler.java:173)
        at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at
org.apache.camel.component.netty4.http.handlers.HttpServerMultiplexChannelHandler.channelRead0(HttpServerMultiplexChannelHandler.java:119)
        at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
        at
io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)
        at
io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:329)
        at
io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)
        at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
        at java.lang.Thread.run(Thread.java:745)

During the init phase of the test, the java system properties
"java.security.auth.login.config" is declared with the location of the jaas
file :

        System.setProperty("java.security.auth.login.config",
"src/test/resources/org/jboss/fuse/security/camel/tls/myjaas.config");

So normally, I shouldn't get this error message

What could be the issue ?

Regards,

--
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io
Reply | Threaded
Open this post in threaded view
|

Re: Netty4 HTTP - JAAS issue

yogu13
Hi,

Rather than init can you set this as part of the systemPropertyVariables in maven-surefire-plugin

Regards,
-Yogesh
Reply | Threaded
Open this post in threaded view
|

Re: Netty4 HTTP - JAAS issue

Charles Moulliard-2
Hi,

I have been able to resolve my issue. The object
java.security.auth.login.Configuration
(responsible to load the file containing the loginModules / realm) is
created one time / java or maven session.

Even if you change the System property "java.security.auth.login.config",
the file loaded for the first JAAS Authentication will be reused all the
time.

To resolve the problem in a project containing several Junit tests, I have
defined all the login Modules within only ONE common file "my-jaas.cfg
file".

Regards,


On Fri, May 6, 2016 at 6:11 AM, yogu13 <[hidden email]> wrote:

> Hi,
>
> Rather than init can you set this as part of the systemPropertyVariables in
> maven-surefire-plugin
> <
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html
> >
>
> Regards,
> -Yogesh
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Netty4-HTTP-JAAS-issue-tp5782122p5782257.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io