List of usage examples for org.apache.shiro.web.config IniFilterChainResolverFactory FILTERS
String FILTERS
To view the source code for org.apache.shiro.web.config IniFilterChainResolverFactory FILTERS.
Click Source Link
From source file:com.meltmedia.cadmium.servlets.shiro.WebEnvironment.java
License:Apache License
@Override protected FilterChainResolver createFilterChainResolver() { Ini.Section section = this.getIni().getSection(TRUSTED_SECTION_NAME); trustedHosts = new ArrayList<String>(); if (!CollectionUtils.isEmpty(section)) { logger.debug("Found " + TRUSTED_SECTION_NAME + " ini section in shiro.ini"); for (String key : section.keySet()) { logger.debug("Adding " + section.get(key) + " to list of trusted ip addresses."); trustedHosts.add(section.get(key).trim()); }/*from w ww . j a v a 2s. co m*/ } if (!CollectionUtils.isEmpty(trustedHosts)) { Ini.Section filterConfigs = getIni().getSection(IniFilterChainResolverFactory.FILTERS); if (CollectionUtils.isEmpty(filterConfigs)) { filterConfigs = getIni().addSection(IniFilterChainResolverFactory.FILTERS); } if (!filterConfigs.containsKey(DefaultFilter.authcBasic.name())) { filterConfigs.put(DefaultFilter.authcBasic.name(), "com.meltmedia.cadmium.servlets.shiro.TrustedBasicHttpAuthenticationFilter"); String trustedHostStr = ""; for (String host : trustedHosts) { if (trustedHostStr.length() > 0) { trustedHostStr += ","; } trustedHostStr += host; } filterConfigs.put(DefaultFilter.authcBasic.name() + ".trustedHosts", trustedHostStr); } } return super.createFilterChainResolver(); }
From source file:com.stormpath.shiro.servlet.env.StormpathShiroIniEnvironment.java
License:Apache License
private void addDefaultsToIni(Ini ini) { // TODO: this is not ideal, we need to make shiro a bit more flexible // and this is tightly coupled with the following method Ini.Section configSection = getConfigSection(ini); // lazy associate the client with the realm, so changes can be made if needed. if (!configSection.containsKey(DEFAULTS_STORMPATH_REALM_PROPERTY + ".client")) { configSection.put(DEFAULTS_STORMPATH_REALM_PROPERTY + ".client", "$" + DEFAULTS_STORMPATH_CLIENT_PROPERTY); }/*from w ww . j a va 2 s .c o m*/ // global properties 'shiro.*' are not loaded from the defaults, we must set it in the ini. if (!configSection.containsKey("shiro.loginUrl")) { configSection.put("shiro.loginUrl", "/login"); } // protect the world if the URL section is missing Ini.Section urls = ini.getSection(IniFilterChainResolverFactory.URLS); Ini.Section filters = ini.getSection(IniFilterChainResolverFactory.FILTERS); // deprecated behavior if (CollectionUtils.isEmpty(urls) && CollectionUtils.isEmpty(filters)) { ini.setSectionProperty(IniFilterChainResolverFactory.URLS, "/**", DefaultFilter.authc.name()); } }