/** Removes a filter by name from all filter request chains. */ public boolean remove(String filterName) { boolean removed = false; for (RequestFilterChain requestChain : requestChains) { removed |= requestChain.getFilterNames().remove(filterName); } return removed; }
void createCompiledFilterList(List<String> list) { list.addAll(getFilterNames()); }
/** * Inserts a filter as the last of the filter list corresponding to the specified pattern. * * @return True if the filter was inserted. */ public boolean insertLast(String pattern, String filterName) { RequestFilterChain requestChain = findAndCheck(pattern, filterName); if (requestChain == null) { return false; } return requestChain.getFilterNames().add(filterName); }
/** * Inserts a filter as the first of the filter list corresponding to the specified pattern. * * @return True if the filter was inserted. */ public boolean insertFirst(String pattern, String filterName) { RequestFilterChain requestChain = findAndCheck(pattern, filterName); if (requestChain == null) { return false; } requestChain.getFilterNames().add(0, filterName); return false; }
/** Get the filters for the specified pattern. */ public List<String> filtersFor(String pattern) { RequestFilterChain requestChain = requestChain(pattern); if (requestChain == null) { return Collections.EMPTY_LIST; } return new ArrayList(requestChain.getFilterNames()); }
RequestFilterChain findAndCheck(String pattern, String filterName) { RequestFilterChain requestChain = requestChain(pattern); if (requestChain == null) { return null; } if (requestChain.getFilterNames().contains(filterName)) { // JD: perhaps we should move it return null; } return requestChain; }
/** * Inserts a filter as after another in the list corresponding to the specified pattern. * * @return True if the filter was inserted. */ public boolean insertAfter(String pattern, String filterName, String positionName) { RequestFilterChain requestChain = findAndCheck(pattern, filterName); if (requestChain == null) { return false; } List<String> filterNames = requestChain.getFilterNames(); int index = filterNames.indexOf(positionName); if (index == -1) { return false; } filterNames.add(index + 1, filterName); return true; }
/** * Inserts a filter as before another in the list corresponding to the specified pattern. * * @return True if the filter was inserted. */ public boolean insertBefore(String pattern, String filterName, String positionName) { RequestFilterChain requestChain = findAndCheck(pattern, filterName); if (requestChain == null) { return false; } List<String> filterNames = requestChain.getFilterNames(); int index = filterNames.indexOf(positionName); if (index == -1) { return false; } filterNames.add(index, filterName); return true; }
/** * Get a list of patterns having the filter in their chain. If includeAll is false, only * authentication filters are searched */ public List<String> patternsForFilter(String filterName, boolean includeAll) { List<String> result = new ArrayList<String>(); for (RequestFilterChain requestChain : requestChains) { List<String> filterNames = includeAll ? requestChain.getCompiledFilterNames() : requestChain.getFilterNames(); if (filterNames.contains(filterName)) { result.addAll(requestChain.getPatterns()); } } return result; }
getSecurityManager().getSecurityConfig().getFilterChain(); for (RequestFilterChain requestChain : chain.getRequestChains()) { for (String filterName : requestChain.getFilterNames()) { if (logoutFilterNames.contains(filterName)) handlerNames.add(filterName);
SecurityManagerConfig config = loadSecurityConfig(); for (RequestFilterChain chain : config.getFilterChain().getRequestChains()) { if (chain.getFilterNames() .contains(GeoServerSecurityFilterChain.SECURITY_CONTEXT_ASC_FILTER)) { chain.setAllowSessionCreation(true); chain.getFilterNames() .remove(GeoServerSecurityFilterChain.SECURITY_CONTEXT_ASC_FILTER); if (chain.getFilterNames() .contains(GeoServerSecurityFilterChain.SECURITY_CONTEXT_NO_ASC_FILTER)) { chain.setAllowSessionCreation(false); chain.getFilterNames() .remove(GeoServerSecurityFilterChain.SECURITY_CONTEXT_NO_ASC_FILTER); chain.getFilterNames() .indexOf( GeoServerSecurityFilterChain .GUI_EXCEPTION_TRANSLATION_FILTER); if (index != -1) chain.getFilterNames() .set( index, if (chain.getFilterNames().indexOf(GeoServerSecurityFilterChain.FORM_LOGIN_FILTER) == -1) { index = chain.getFilterNames() .indexOf(GeoServerSecurityFilterChain.ANONYMOUS_FILTER); if (index == -1)
for (String filterName : requestChain.getFilterNames()) { writer.startNode("filter"); writer.setValue(filterName);
protected void removeAnonymousFilter() throws Exception { SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig(); mconfig.getFilterChain() .find(pattern) .getFilterNames() .remove(GeoServerSecurityFilterChain.ANONYMOUS_FILTER); getSecurityManager().saveSecurityConfig(mconfig); }
protected void insertAnonymousFilter() throws Exception { SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig(); mconfig.getFilterChain() .find(pattern) .getFilterNames() .add(GeoServerSecurityFilterChain.ANONYMOUS_FILTER); getSecurityManager().saveSecurityConfig(mconfig); }
if (requestChain.isDisabled() == false && requestChain.getFilterNames().isEmpty()) throw createSecurityException( SecurityConfigException.FILTER_CHAIN_EMPTY_$1, requestChain.getName()); .getFilterNames() .indexOf(GeoServerSecurityFilterChain.ANONYMOUS_FILTER); if (index != -1 && index != requestChain.getFilterNames().size() - 1) throw createSecurityException( SecurityConfigException.ANONYMOUS_NOT_LAST_$1, requestChain.getName()); for (String filterName : requestChain.getFilterNames()) { GeoServerSecurityFilter filter = null; try {
public List<String> getFilterNames() { return chain.getFilterNames(); } public void setFilterNames(String... filterNames) {
public List<String> getFilterNames() { return chain.getFilterNames(); }
@Override public List<String> getObject() { GeoServerSecurityManager secMgr = getSecurityManager(); List<String> filters = new ArrayList(requestChain.getFilterNames()); try { filters.retainAll(secMgr.listFilters(GeoServerAuthenticationFilter.class)); } catch (IOException e) { throw new RuntimeException(e); } return filters; }
@Override public List<String> getObject() { GeoServerSecurityManager secMgr = getSecurityManager(); List<String> filters = new ArrayList<String>(chainModel.getChain().getFilterNames()); try { filters.retainAll(chainModel.getVariableFilterChain().listFilterCandidates(secMgr)); } catch (IOException e) { throw new RuntimeException(e); } return filters; }
@Override public List<String> getObject() { GeoServerSecurityManager secMgr = getSecurityManager(); List<String> filters = new ArrayList<String>(chainModel.getChain().getFilterNames()); try { filters.retainAll(chainModel.getVariableFilterChain().listFilterCandidates(secMgr)); } catch (IOException e) { throw new RuntimeException(e); } return filters; }