I believe you can do something like this: (untested) ds = org.apache.shiro.jndi.JndiObjectFactory ds.resourceName = jdbc/myDS ds.requiredType = javax.sql.DataSource # optional, but nice for early failures
jdbcRealm.datasource = $ds -Jared On Fri 18 May 2012 04:51:17 PM CDT, Paulo Pires wrote: > Hi all, > > How can one define a DataSource in 'shiro.ini' pointing to a JNDI. For > instance, I have the following properties set: > > ds = com.jolbox.bonecp.BoneCPDataSource > ds.driverClass=com.mysql.jdbc.Driver > ds.jdbcUrl=jdbc:mysql://localhost:3306/simple_shiro_web_app > ds.username = root > ds.password = 123qwe > jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm > jdbcRealm.dataSource=$ds > > Unfortunately, everyone that has access to my WAR package is able to > read this configuration and eventually misuse it. And I don't want to > discuss here that I could create a MySQL user with read-only > permissions to the tables Shiro needs. That's not my point. > > What I'd really like, is to simply refer a JNDI path like this: > # DataSource previously configured in the container > ds = jdbc/myDS > jdbcRealm.datasource = $ds > > Is this even possible? If not, would it interest anyone else? > > Cheers, > -- > Paulo Pires
