Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-15995

User name does not propagate with programmatic authentication for remote ejb calls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 25.0.1.Final
    • EJB, Remoting
    • None

    Description

      When I try to set the user and credentials for the security context to invoke remote ejb calls from one server to another, the user is not set. The user is correctly authenticated for standalone remote clients.

      The code snippet I tried is

           public OMSCoreServicesWrapperRemote lookupConnectorFacadeRemote(String ip, String uniReqId) {
              try

      {                          // create your authentication configuration             AuthenticationConfiguration namingConfig = AuthenticationConfiguration                     .empty()                     .useName("ejbUser")                     .usePassword("password")                     .useRealm("ApplicationRealm")                     .setSaslMechanismSelector(SaslMechanismSelector.NONE.addMechanism("DIGEST-MD5"))                     .useProviders( () -> new Provider[]

      { new WildFlyElytronProvider() }

      );
                  // create your authentication context
                  AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, namingConfig);
                  context.getInstanceContextManager().setThreadDefault(context);
                  context.getInstanceContextManager().setGlobalDefault(context);
                  return context.runCallable(vCallable);
              } catch (Exception e)

      {             logger.error("LN:1460", "OMSCoreServicesWrapperRemote look up failed for ip:" + ip, e.getMessage());                  }

          }

          Callable<OMSCoreServicesWrapperRemote> vCallable = () ->

      {         String ip = "192.168.14.55";                   Properties jndiProps = new Properties();                       jndiProps.put(Context.SECURITY_PRINCIPAL, "ejbUser");                       jndiProps.put(Context.SECURITY_CREDENTIALS, "password");                   jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");                     jndiProps.put(Context.PROVIDER_URL, System.getProperty("remote+http://192.168.0.51:8181");                  Context ctx = new InitialContext(jndiProps);                  String lookupName = ejbServiceLocatorI.getMergedEjbLookupNameMapperRemote().get(OMSCoreServicesWrapperRemote.class.getSimpleName());                  return (OMSCoreServicesWrapperRemote) ctx.lookup(lookupName);     }

      ;

      server.log attachment contains the complete log since the server start up.

      standalone-full_xml is the config file of the server

      The resources I referred to solve this issue are

      https://developer.jboss.org/thread/277371

      https://github.com/wildfly/quickstart/tree/11.x/ejb-security-context-propagation

      But the issue remains the same.

      Attachments

        1. screenshot-1.png
          49 kB
          Nuwani Senanayake
        2. server.log
          26.22 MB
          Nuwani Senanayake
        3. standalone-full_xml.txt
          34 kB
          Nuwani Senanayake

        Activity

          People

            istudens@redhat.com Ivo Studensky
            nuwani Nuwani Senanayake (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: