0 Replies Latest reply on May 12, 2015 1:31 PM by rodrigo.uchoa

    How to authenticate programmatically in Wildfly 8.2.0?

    rodrigo.uchoa

      Hi everyone!

       

      I have custom two custom login modules, actually one is a login module and the other a mapping module, both developed on top of PicketBox (the version shipped with Wildfly 8.2.0). I extended some of the modules already provided by PicketBox to my needs.

       

      When I'm using a regular JavaEE aware app, such as a simple Servlet application with BASIC authentication mechanism, it all works great. It authenticates and all the roles are mapped accordingly.

       

      Thing is that I have an application developed with Apache Wicket. Which doesn't work with JAAS out of box. So to overcome this problem I tried to do a programmatic login using the JAAS api. It looked something like this:

       

      LoginCallbackHandler handler = new LoginCallbackHandler(username, password);
      LoginContext ctx = new LoginContext("my-security-domain", handler);
      ctx.login();
      //etc etc etc
      

       

      The authentication worked  ok. But for some reason the role mapping is not. I noticed that the method performMapping() from my mapping provider class isn't even being invoked. Since everything works with the regular non-programmatic approach, I'm assuming it has something to do with the programmatic one.

       

      Does anyone know a way to do a programmatic login, which also triggers the role mapping module? Is there any way of doing this with the core PicketBox API?

       

      Regards!