[ 
https://issues.apache.org/jira/browse/KARAF-2822?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Fang updated KARAF-2822:
--------------------------------

    Summary: org.apache.karaf.jaas.modules.jdbc.JDBCUtils.OSGI contains 
"bundles:" not "osgi:" as required by the OSGi JNDI spec"  (was: 
org.apache.karaf.jaas.modules.jdbc.JDBCUtils.OSGI contains "bundles:" not 
"osgi:" as required by the OSGN JNDI spec")

> org.apache.karaf.jaas.modules.jdbc.JDBCUtils.OSGI contains "bundles:" not 
> "osgi:" as required by the OSGi 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
>            Assignee: Freeman Fang
>            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)

Reply via email to