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.AjaxFormAuthenticationFilter\ > 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 > > >
