4 Replies Latest reply on Feb 17, 2019 6:03 AM by Wolfgang Mayer

    WildFly 15, get password ejb-remote: "Remote EJB Client Example"

    Oleg Burakov Newbie

      Good day!

       

      There is a very large system built on JBoss 6. To log in to the user, the username and password to connect to the database I must take from the client side of the program.

      The username and password to log in are the same as the username and password in the database.

       

      I found in the examples how to get the username (ctx.getCallerPrincipal ()).

       

      Can you please tell me how to get a password in WildFly 15?

       

      An example was taken in "quickstart" - ejb-remote: "Remote EJB Client Example".

       

      Example get Principal:

          // Inject the Session Context
          @Resource
          private SessionContext ctx;
      .....
              Principal principal = ctx.getCallerPrincipal();
                      return principal.toString();
        • 1. Re: WildFly 15, get password ejb-remote: "Remote EJB Client Example"
          Oleg Burakov Newbie

          In JBoss 6 AS we used the configuration shown below.

          In WildFly 15 there is a mechanism that implements a configuration similar to JBoss 6 AS?

           

           

          Sorry my english.

          For earlier thanks for the answer.

           

          Configuration Jboss AS 6:

            <application-policy name = "IGRoles">
               <authentication>  
                    <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"  
                      flag = "required">  
                      <module-option name="usersProperties">IG_users.properties</module-option>  
                      <module-option name="rolesProperties">IG_roles.properties</module-option>  
                    </login-module>  
                </authentication>  
              </application-policy>  
          

           

              <application-policy name = "IG_CallerDS">  
                <authentication>  
                    <login-module code = "org.jboss.resource.security.CallerIdentityLoginModule"  
                      flag = "required">  
                      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OraDSIG</module-option>  
                    </login-module>  
                </authentication>  
              </application-policy>  
          
          

           

          <datasources>  
            <local-tx-datasource>  
              <jndi-name>OraDSIG</jndi-name>  
          <connection-url>jdbc:oracle:thin:@localhost:1521:olg1</connection-url>  
          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>  
          <security-domain>IG_CallerDS</security-domain>  
          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>  
          </local-tx-datasource>  
          </datasources> 
          
          • 2. Re: WildFly 15, get password ejb-remote: "Remote EJB Client Example"
            Wolfgang Mayer Master

            This should still be possible in WildFly either via Security Domain (PicketBox security) or Authentication Context (Elytron)

            • 3. Re: WildFly 15, get password ejb-remote: "Remote EJB Client Example"
              Oleg Burakov Newbie

              Wolfgang perhaps you have an example for the Authentication Context (Elytron)?

              • 4. Re: WildFly 15, get password ejb-remote: "Remote EJB Client Example"
                Wolfgang Mayer Master

                1. Enable elytron on this data source like:

                /subsystem=datasources/data-source=MySQLTestDS:write-attribute(name=elytron-enabled,value=true)

                 

                2. Create a authentication configuration for the authentication context eg via

                Security (Elytron> -> Other Settings -> Authentication -> Authentication Configuration

                 

                authentication

                To make it simple the password may be entered as clear text in the credentials

                credential

                 

                3. Create an Athentication Context eg via

                Security (Elytron> -> Other Settings -> Authentication -> Authentication Context

                context

                and select the configuration

                 

                4. Enter the authentication context in the Security tab

                datasource