Karaf
  1. Karaf
  2. KARAF-1394

Custom login modules not seen with Equinox

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 2.2.8, 2.3.0, 3.0.0
    • Component/s: karaf-core
    • Labels:
      None

      Description

      An user define a "custom" login module, for instance, in the blueprint descriptor of its own bundle:

      <jaas:config name="karaf " rank="1">
      <jaas:module className="org.apache.karaf.jaas.modules.jdbc.JDBCLoginModule" flags="required">
      datasource = osgi:javax.sql.DataSource/(osgi.jndi.service.name=jdbc/karafdb)
      query.password = SELECT PASSWORD FROM USERS WHERE USERNAME=?
      query.role = SELECT ROLE FROM ROLES WHERE USERNAME=?
      </jaas:module>
      </jaas:config>

      with a default Karaf instance (using Felix OSGi framework), the jaas:realms command shows the default PropertiesLoginModule and the user one.

      However, if the user switch to Equinox OSGi framework, only the default PropertiesLoginModule is seen, not the user one when performing jaas:realms.

        Activity

        Hide
        Jean-Baptiste Onofré added a comment -

        Even when using Felix OSGi framework, we have this behaviour here:

        • when we use the first realm (PropertiesLoginModule) and do a "jaas:users", we get a correct list of users.
        • when we switch to the second realm (JDBCLoginModule) and do a "jaas:users", we get:

        "Failed to resolve backing engine for realm:karaf and moudle:org.apache.karaf.jaas.boot.ProxyLoginModule"

        Show
        Jean-Baptiste Onofré added a comment - Even when using Felix OSGi framework, we have this behaviour here: when we use the first realm (PropertiesLoginModule) and do a "jaas:users", we get a correct list of users. when we switch to the second realm (JDBCLoginModule) and do a "jaas:users", we get: "Failed to resolve backing engine for realm:karaf and moudle:org.apache.karaf.jaas.boot.ProxyLoginModule"
        Hide
        Jean-Baptiste Onofré added a comment -

        In fact, the issue was that the backing engine service was not there (mistake in my blueprint descriptor). I added:

        <service interface="org.apache.karaf.jaas.modules.BackingEngineFactory">
        <bean class="org.apache.karaf.jaas.modules.jdbc.JDBCBackingEngineFactory"/>
        </service>

        and on Equinox, I'm able to see the two realms.

        Show
        Jean-Baptiste Onofré added a comment - In fact, the issue was that the backing engine service was not there (mistake in my blueprint descriptor). I added: <service interface="org.apache.karaf.jaas.modules.BackingEngineFactory"> <bean class="org.apache.karaf.jaas.modules.jdbc.JDBCBackingEngineFactory"/> </service> and on Equinox, I'm able to see the two realms.
        Hide
        Jean-Baptiste Onofré added a comment -

        At least, the documentation should be updated to inform the users to expose the backing engine as a service.

        Show
        Jean-Baptiste Onofré added a comment - At least, the documentation should be updated to inform the users to expose the backing engine as a service.
        Hide
        Jean-Baptiste Onofré added a comment -

        NB: the custom JAAS module should also import

        org.apache.karaf.jaas.config;resolution:=optional

        to be visible in Karaf.

        Show
        Jean-Baptiste Onofré added a comment - NB: the custom JAAS module should also import org.apache.karaf.jaas.config;resolution:=optional to be visible in Karaf.

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Jean-Baptiste Onofré
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development