public RequestFilterChain getRequestChainByName(String name) { for (RequestFilterChain requestChain : requestChains) { if (requestChain.getName().equals(name)) { return requestChain; } } return null; }
public static RequestFilterChain lookupRequestChainByName( String name, GeoServerSecurityManager secMgr) { // this is kind of a hack but we create an initial filter chain and run it through the // security provider extension points to get an actual final chain, and then look through // the elements for a matching name GeoServerSecurityFilterChain filterChain = createInitialChain(); filterChain.postConfigure(secMgr); for (RequestFilterChain requestChain : filterChain.getRequestChains()) { if (requestChain.getName().equals(name)) { return requestChain; } } return null; }
public void validateRequestFilterChain(RequestFilterChain requestChain) throws SecurityConfigException { if (isNotEmpty(requestChain.getName()) == false) { throw createSecurityException(SecurityConfigException.FILTER_CHAIN_NAME_MANDATORY); SecurityConfigException.PATTERN_LIST_EMPTY_$1, requestChain.getName()); throw createSecurityException( SecurityConfigException.UNKNOWN_ROLE_FILTER_$2, requestChain.getName(), roleFilterName); if (requestChain.isDisabled() == false && requestChain.getFilterNames().isEmpty()) throw createSecurityException( SecurityConfigException.FILTER_CHAIN_EMPTY_$1, requestChain.getName()); throw createSecurityException( SecurityConfigException.UNKNOWN_INTERCEPTOR_FILTER_$2, requestChain.getName(), interceptorFilterName); throw createSecurityException( SecurityConfigException.INTERCEPTOR_FILTER_MANDATORY_$1, requestChain.getName()); throw createSecurityException( SecurityConfigException.UNKNOWN_EXCEPTION_FILTER_$2, requestChain.getName(), exceptionTranslationName);
path, GeoServerSecurityManager.this); if (requestChain != null) { name = requestChain.getName(); } else { name = path;
if (chain.getRequestChainByName(oldRequestChain.getName()) == null) { if (oldRequestChain.canBeRemoved() == false) { throw createSecurityException( SecurityConfigException.FILTER_CHAIN_NOT_REMOVEABLE_$1, oldRequestChain.getName()); Set<String> chainNames = new HashSet<String>(); if (isNotEmpty(requestChain.getName()) == false) { throw createSecurityException(SecurityConfigException.FILTER_CHAIN_NAME_MANDATORY); if (chainNames.contains(requestChain.getName())) { throw createSecurityException( SecurityConfigException.FILTER_CHAIN_NAME_NOT_UNIQUE_$1, requestChain.getName()); chainNames.add(requestChain.getName());
if (GeoServerSecurityFilterChain.WEB_CHAIN_NAME.equals(chain.getName())) {
@Override public String getIdValue(RequestFilterChain object, int index) { return object.getName(); } });
public String getName() { return chain.getName(); } public List<String> getPatterns() {
public String getName() { return chain.getName(); }
@Override public Object getDisplayValue(RequestFilterChain object) { String name = object.getName(); return new ResourceModel(RequestFilterChain.class.getSimpleName()+"."+name,name).getObject(); } @Override
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { try { String result="NONE"; HttpServletRequest request = getHttpRequest(); for (RequestFilterChain chain : config.getFilterChain().getRequestChains()) { if (httpMethod!=null && urlPath!=null) { if (getProxy().matcherForChain(chain).matches(request)) { result=chain.getName(); break; } } } chainTestResultField.getModel().setObject(result); target.addComponent(chainTestResultField); } catch(Exception e) { error(e); LOGGER.log(Level.WARNING, "Connection error", e); target.addComponent(feedbackPanel); } } protected GeoServerSecurityFilterChainProxy getProxy() {
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { try { String result = "NONE"; HttpServletRequest request = getHttpRequest(); for (RequestFilterChain chain : config.getFilterChain().getRequestChains()) { if (httpMethod != null && urlPath != null) { if (getProxy().matcherForChain(chain).matches(request)) { result = chain.getName(); break; } } } chainTestResultField.getModel().setObject(result); target.add(chainTestResultField); } catch (Exception e) { error(e); LOGGER.log(Level.WARNING, "Connection error", e); addFeedbackPanels(target); } }
assertFalse(StringUtils.hasLength(chain.getRoleFilterName())); if (GeoServerSecurityFilterChain.WEB_CHAIN_NAME.equals(chain.getName()) || GeoServerSecurityFilterChain.WEB_LOGIN_CHAIN_NAME.equals(chain.getName()) || GeoServerSecurityFilterChain.WEB_LOGOUT_CHAIN_NAME.equals(chain.getName())) assertTrue(chain.isAllowSessionCreation()); else assertFalse(chain.isAllowSessionCreation());