Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-8702

Code within container can't authenticate using Elytron

XMLWordPrintable

    • Blocks Testing

      Given a secured EJB which is using an Elytron security domain, a piece of code inside a deployment wants to call it (and needs to authenticate in order to do it).
      Given that the old JAAS way with LoginContext is not supported with Elytron, I assume this should work with the new AuthenticationContext.

      This code:

      AuthenticationConfiguration common = AuthenticationConfiguration.EMPTY
                      .useProviders(() -> new Provider[] {new WildFlyElytronProvider()});
      AuthenticationConfiguration user1credentials = common.useName("user1").usePassword("pass1");
      AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, user1credentials);
      context.run((PrivilegedExceptionAction<String>)() ->
                      ((MyAwesomeEJB)new InitialContext().lookup("java:module/The-EJB-Name")).method());
      

      This will not authenticate the user in order to be able to call a secured EJB. We were unable to find any documentation on this and it seems logical that this should work - there might be something we are missing, in which case I'm asking for advice how to make this work.

            darran.lofthouse@redhat.com Darran Lofthouse
            jmartisk@redhat.com Jan Martiska
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: