karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jirka (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-2822) org.apache.karaf.jaas.modules.jdbc.JDBCUtils.OSGI contains "bundles:" not "osgi:" as required by the OSGN JNDI spec"
Date Sun, 16 Mar 2014 16:05:42 GMT
Jirka created KARAF-2822:
----------------------------

             Summary: org.apache.karaf.jaas.modules.jdbc.JDBCUtils.OSGI contains "bundles:"
not "osgi:" as required by the OSGN JNDI spec"
                 Key: KARAF-2822
                 URL: https://issues.apache.org/jira/browse/KARAF-2822
             Project: Karaf
          Issue Type: Bug
          Components: karaf-security
    Affects Versions: 3.0.0
            Reporter: Jirka
            Priority: Minor


According to the OSGI spec the JNDI should be:
??service ::= ’osgi:service/’ query??

This is correctly documented in the Karaf doc:
[http://karaf.apache.org/manual/latest/developers-guide/security-framework.html]

However, JDBCLoginModule
[https://git-wip-us.apache.org/repos/asf?p=karaf.git;a=blob_plain;f=jaas/modules/src/main/java/org/apache/karaf/jaas/modules/jdbc/JDBCLoginModule.java;hb=master]

contains:
{code:title=JDBCLoginModule.java|borderStyle=solid}
if (!datasourceURL.startsWith(JDBCUtils.JNDI) && !datasourceURL.startsWith(JDBCUtils.OSGI))
{
            LOGGER.error("Invalid datasource lookup protocol");
{code}

where JDBCUtils.OSGI contains "bundles:"
[https://git-wip-us.apache.org/repos/asf?p=karaf.git;a=blob_plain;f=jaas/modules/src/main/java/org/apache/karaf/jaas/modules/jdbc/JDBCUtils.java;hb=master]

{code:title=JDBCUtils.java|borderStyle=solid}
    public static final String DATASOURCE = "datasource";
    public static final String JNDI = "jndi:";
    public static final String OSGI = "bundles:";
{code}
This causes that the authentication using JDBCLoginModule fails.

A workaround is to define datasource starting with *bundles:* in place of *osgi:* in blueprint
{code:xml}
<jaas:config name="karaf">
    <jaas:module className="org.apache.karaf.jaas.modules.jdbc.JDBCLoginModule" 
                 flags="required">
        datasource = bundles: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>
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message