Package org.geoserver.security

Examples of org.geoserver.security.GeoServerSecurityFilterChainProxy


            MockFilterChain chain = new MockFilterChain();
            String paramValue = URLDecoder.decode(buff.toString(), "utf-8");
            request.setupAddParameter("logoutRequest",
                    paramValue.substring(paramValue.indexOf("=") + 1));
            try {
                GeoServerSecurityFilterChainProxy proxy = getProxy();
                System.out.println("SERVCIE: " + service);
                System.out.println("URL: " + request.getRequestURL().toString());
                for (SecurityFilterChain c : proxy.getFilterChains()) {
                    System.out.println(c.toString());
                }
                proxy.doFilter(request, response, chain);
            } catch (ServletException e) {
                throw new RuntimeException(e);
            }
            assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
View Full Code Here


       
        if (requestChain.getPatterns().isEmpty()) {
            throw createSecurityException(SecurityConfigException.PATTERN_LIST_EMPTY_$1,requestChain.getName());
        }
       
        GeoServerSecurityFilterChainProxy proxy = GeoServerExtensions.bean(GeoServerSecurityFilterChainProxy.class);
       
        String roleFilterName =  requestChain.getRoleFilterName();
        if (StringUtils.hasLength(roleFilterName)) {
            try {
                if (proxy.lookupFilter(roleFilterName)==null) {               
                    throw createSecurityException(SecurityConfigException.UNKNOWN_ROLE_FILTER_$2,requestChain.getName(),roleFilterName);
                }               
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }
       
       

        if (requestChain instanceof VariableFilterChain) {
            if (requestChain.isDisabled()==false && requestChain.getFilterNames().isEmpty())
                throw createSecurityException(SecurityConfigException.FILTER_CHAIN_EMPTY_$1,requestChain.getName());
           
            String interceptorFilterName =  ((VariableFilterChain) requestChain).getInterceptorName();
            if (StringUtils.hasLength(interceptorFilterName)) {
                try {
                    if (proxy.lookupFilter(interceptorFilterName)==null) {               
                        throw createSecurityException(SecurityConfigException.UNKNOWN_INTERCEPTOR_FILTER_$2,requestChain.getName(),interceptorFilterName);
                    }
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            } else {
                throw createSecurityException(SecurityConfigException.INTERCEPTOR_FILTER_MANDATORY_$1,requestChain.getName());
            }
           
            String exceptionTranslationName =  ((VariableFilterChain) requestChain).getExceptionTranslationName();
            if (StringUtils.hasLength(exceptionTranslationName)) {
                try {
                    if (proxy.lookupFilter(exceptionTranslationName)==null) {               
                        throw createSecurityException(SecurityConfigException.UNKNOWN_EXCEPTION_FILTER_$2,requestChain.getName(),exceptionTranslationName);
                    }
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            } else {
                throw createSecurityException(SecurityConfigException.EXCEPTION_FILTER_MANDATORY_$1,requestChain.getName());
            }

           
            int index = requestChain.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 {
                        filter = (GeoServerSecurityFilter)proxy.lookupFilter(filterName);
                    } catch (IOException ex) {
                        throw new RuntimeException(ex);
                    }
                    if (filter==null)
                        throw createSecurityException(SecurityConfigException.UNKNOWN_FILTER_$2,requestChain.getName(),filterName);
View Full Code Here

TOP

Related Classes of org.geoserver.security.GeoServerSecurityFilterChainProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.