Will do. Thanks. /Bengt
Den 8 nov. 2016 5:26 em skrev "Brian Demers" <[email protected]>: > It will be removed in 2.0. Until then, only critical issues associated > with the IniShiroFilter would be fixed, but it should function the same way > until then. > > Dynamic configuration support is a big range. That said, there is support > for annotations, Guice, and Spring, which could be considered dynamic. 1.4 > will also have support for property interpolation (but currently it is only > the right hand side of the config line (i.e: myProperty = > ${mySystemProperty} ) > > Take a look at the IniWebEnvironment, and if you can think of a way to > make it a bit more generic for you needs let us know! > > > On Tue, Nov 8, 2016 at 10:21 AM, Bengt Rodehav <[email protected]> wrote: > >> OK - thanks, >> >> Wouldn't it be nice to support dynamic configuration out-of-the-box? >> >> When do you plan to remove the IniShiroFilter? Is it safe to use until >> then or could it cause problems? >> >> /Bengt >> >> 2016-11-08 15:44 GMT+01:00 Brian Demers <[email protected]>: >> >>> >>> You could extend the 'IniWebEnvironment' and do something similar. Just >>> set the servlet init param 'shiroEnvironmentClass' to your new class. >>> >>> Basically the Ini processing _should_ now happen in the 'Environment' >>> instead of directly in the Filter. >>> >>> Let me know if that doesn't help. >>> >>> >>> On Tue, Nov 8, 2016 at 3:25 AM, Bengt Rodehav <[email protected]> wrote: >>> >>>> I'm migrating from an older version of Shiro to Shiro 1.3.2. >>>> >>>> I noticed that the IniFilter has been deprecated. I used the IniFilter >>>> to dynamically create the Shiro configuration as follows: >>>> >>>> Dictionary<String, String> filterProps = new Hashtable<String, >>>> String>(); >>>> filterProps.put("config", buildShiroConfig()); >>>> IniShiroFilter iniFilter = new IniShiroFilter(); >>>> mWebService.registerFilter(iniFilter, new String[] { "/*" }, new >>>> String[] { VIEW_SERVLET_NAME }, filterProps, mHttpContext); >>>> >>>> My method "buildShiroConfig" looks as follows: >>>> >>>> private String buildShiroConfig() { >>>> StringBuilder sb = new StringBuilder(); >>>> >>>> sb.append("[main]\n"); >>>> >>>> sb.append("authc.loginUrl = " + mRootUrl + "/admin/login\n"); >>>> sb.append("authc.successUrl = " + mRootUrl + "/admin/index.html\n"); >>>> sb.append("logout.redirectUrl = " + mRootUrl + "/admin/login\n"); >>>> sb.append("ajaxFilter = se.digia.hp.web.AjaxFormAuthen >>>> ticationFilter\n"); >>>> >>>> sb.append("ds = org.apache.shiro.jndi.JndiObjectFactory\n"); >>>> sb.append("ds.resourceName = osgi:service/javax.sql.DataSource/( >>>> osgi.jndi.service.name=jdbc/hpnojta)\n"); >>>> sb.append("jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm\n"); >>>> sb.append("jdbcRealm.dataSource = $ds\n"); >>>> sb.append("jdbcRealm.authenticationQuery = SELECT password FROM >>>> _user WHERE name = ?\n"); >>>> >>>> sb.append("[urls]\n"); >>>> sb.append(mRootUrl + "/api/login = anon\n"); >>>> sb.append(mRootUrl + "/api/getCurrentUser = anon\n"); >>>> sb.append(mRootUrl + "/api/** = ajaxFilter\n"); >>>> sb.append(mRootUrl + "/admin/login = authc\n"); >>>> sb.append(mRootUrl + "/admin/logout = logout\n"); >>>> sb.append(mRootUrl + "/admin/** = authc\n"); >>>> >>>> // sb.append("[users]\n"); >>>> // sb.append("user=password\n"); >>>> >>>> return sb.toString(); >>>> } >>>> >>>> Most of the information is static but I have a configurable root URL >>>> which requires me to create the configuration dynamically. How can I do >>>> this using ShiroFilter? >>>> >>>> /Bengt >>>> >>>> >>>> >>> >> >
